JSONEncodingError.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Sources/SwiftProtobuf/JSONEncodingError.swift - Error constants
  2. //
  3. // Copyright (c) 2014 - 2016 Apple Inc. and the project authors
  4. // Licensed under Apache License v2.0 with Runtime Library Exception
  5. //
  6. // See LICENSE.txt for license information:
  7. // https://github.com/apple/swift-protobuf/blob/main/LICENSE.txt
  8. //
  9. // -----------------------------------------------------------------------------
  10. ///
  11. /// Enum constants that identify the particular error.
  12. ///
  13. // -----------------------------------------------------------------------------
  14. public enum JSONEncodingError: Error, Hashable {
  15. /// Any fields that were decoded from binary format cannot be
  16. /// re-encoded into JSON unless the object they hold is a
  17. /// well-known type or a type registered with via
  18. /// Google_Protobuf_Any.register()
  19. case anyTranscodeFailure
  20. /// Timestamp values can only be JSON encoded if they hold a value
  21. /// between 0001-01-01Z00:00:00 and 9999-12-31Z23:59:59.
  22. case timestampRange
  23. /// Duration values can only be JSON encoded if they hold a value
  24. /// less than +/- 100 years.
  25. case durationRange
  26. /// Field masks get edited when converting between JSON and protobuf
  27. case fieldMaskConversion
  28. /// Field names were not compiled into the binary
  29. case missingFieldNames
  30. /// Instances of `Google_Protobuf_Value` can only be encoded if they have a
  31. /// valid `kind` (that is, they represent a null value, number, boolean,
  32. /// string, struct, or list).
  33. case missingValue
  34. /// google.protobuf.Value cannot encode double values for infinity or nan,
  35. /// because they would be parsed as a string.
  36. case valueNumberNotFinite
  37. }