deser/des/errors

Types

DeserializationError = object of DeserError
Error during deserialization   Source   Edit
DuplicateField = object of DeserializationError
Raised when a Deserialize struct type received more than one of the same field.   Source   Edit
InvalidLength = object of DeserializationError
Raised when deserializing a sequence or map and the input data contains too many or too few elements.   Source   Edit
InvalidType = object of DeserializationError
Raised when a Deserialize receives a type different from what it was expecting.   Source   Edit
InvalidValue = object of DeserializationError
Raised when a Deserialize receives a value of the right type but that is wrong for some other reason.   Source   Edit
MissingField = object of DeserializationError
Raised when a Deserialize struct type expected to receive a required field with a particular name but that field was not present in the input.   Source   Edit
Unexpected = object
  case kind*: UnexpectedKind
  of Bool:
      boolValue*: bool

  of Unsigned:
      unsignedValue*: uint64

  of Signed:
      signedValue*: int64

  of Float:
      floatValue*: float64

  of Char:
      charValue*: char

  of String:
      stringValue*: string

  of Bytes:
      bytesValue*: seq[byte]

  else:
      nil

  
  Source   Edit
UnexpectedKind = enum
  Bool, Unsigned, Signed, Float, Char, String, Bytes, Option, Seq, Map
  Source   Edit
UnknownField = object of DeserializationError
Raised when a Deserialize enum type received a variant with an unrecognized name.   Source   Edit
UnknownUntaggedVariant = object of DeserializationError
Raised when a Deserialize struct type cannot derive case variant.   Source   Edit

Procs

func `$`(self: Unexpected): string {.inline, ...raises: [ValueError], tags: [].}
  Source   Edit
func initUnexpectedBool(value: bool): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedBytes(value: sink seq[byte]): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedChar(value: char): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedFloat(value: float64): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedMap(): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedOption(): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedSeq(): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedSigned(value: int64): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedString(value: sink string): auto {....raises: [], tags: [].}
  Source   Edit
func initUnexpectedUnsigned(value: uint64): auto {....raises: [], tags: [].}
  Source   Edit
proc raiseDuplicateField(field: static[string]) {.noinline, noreturn.}
  Source   Edit
proc raiseInvalidLength(unexp: int; exp: auto) {.noinline, noreturn.}
  Source   Edit
proc raiseInvalidType(unexp: Unexpected; exp: auto) {.noinline, noreturn.}
  Source   Edit
proc raiseInvalidValue(unexp: Unexpected; exp: auto) {.noinline, noreturn.}
  Source   Edit
proc raiseMissingField(field: static[string]) {.noinline, noreturn.}
  Source   Edit
proc raiseUnknownField(unexp: sink string) {.noinline, noreturn,
    ...raises: [UnknownField, ValueError], tags: [].}
  Source   Edit
proc raiseUnknownUntaggedVariant(struct: static[string]; field: static[string]) {.
    noinline, noreturn.}
  Source   Edit