File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ internal class AnyMessageStorage {
210
210
case . contentJSON( let contentJSON, let options) :
211
211
// contentJSON requires we have the type available for decoding
212
212
guard let messageType = Google_Protobuf_Any . messageType ( forTypeURL: _typeURL) else {
213
- throw BinaryEncodingError . anyTranscodeFailure
213
+ throw BinaryEncodingError . anyTypeURLNotRegistered ( typeURL : _typeURL )
214
214
}
215
215
do {
216
216
// Decodes the full JSON and then discard the result.
@@ -414,7 +414,7 @@ extension AnyMessageStorage {
414
414
// binary value, so we're stuck. (The Google spec does not
415
415
// provide a way to just package the binary value for someone
416
416
// else to decode later.)
417
- throw JSONEncodingError . anyTranscodeFailure
417
+ throw JSONEncodingError . anyTypeURLNotRegistered ( typeURL : _typeURL )
418
418
}
419
419
let m = try messageType. init ( serializedBytes: valueData, partial: true )
420
420
return try serializeAnyJSON ( for: m, typeURL: _typeURL, options: options)
Original file line number Diff line number Diff line change 13
13
// -----------------------------------------------------------------------------
14
14
15
15
/// Describes errors that can occur when decoding a message from binary format.
16
- public enum BinaryEncodingError : Error {
16
+ public enum BinaryEncodingError : Error , Equatable {
17
17
/// `Any` fields that were decoded from JSON cannot be re-encoded to binary
18
18
/// unless the object they hold is a well-known type or a type registered via
19
19
/// `Google_Protobuf_Any.register()`.
20
+ case anyTypeURLNotRegistered( typeURL: String )
21
+ /// An unexpected failure when deserializing a `Google_Protobuf_Any`.
20
22
case anyTranscodeFailure
21
-
22
23
/// The definition of the message or one of its nested messages has required
23
24
/// fields but the message being encoded did not include values for them. You
24
25
/// must pass `partial: true` during encoding if you wish to explicitly ignore
25
26
/// missing required fields.
26
27
case missingRequiredFields
27
-
28
28
/// Messages are limited to a maximum of 2GB in encoded size.
29
29
case tooLarge
30
30
}
Original file line number Diff line number Diff line change 12
12
///
13
13
// -----------------------------------------------------------------------------
14
14
15
- public enum JSONEncodingError : Error {
15
+ public enum JSONEncodingError : Error , Equatable {
16
16
/// Any fields that were decoded from binary format cannot be
17
17
/// re-encoded into JSON unless the object they hold is a
18
18
/// well-known type or a type registered with via
19
19
/// Google_Protobuf_Any.register()
20
- case anyTranscodeFailure
20
+ case anyTypeURLNotRegistered ( typeURL : String )
21
21
/// Timestamp values can only be JSON encoded if they hold a value
22
22
/// between 0001-01-01Z00:00:00 and 9999-12-31Z23:59:59.
23
23
case timestampRange
You can’t perform that action at this time.
0 commit comments