aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBCodedInputStream.h
diff options
context:
space:
mode:
authorSergio Campamá <kaipi@google.com>2016-06-02 11:14:26 -0700
committerThomas Van Lenten <thomasvl@google.com>2016-06-02 14:14:26 -0400
commite34c09182ebe0ed2958aefa809159498923743d3 (patch)
tree2eaf97f34c4ece1c6391fb795b20acc2d46fa145 /objectivec/GPBCodedInputStream.h
parent0ab7a7f74458be56bfc65a71a46711637ee5962b (diff)
downloadprotobuf-e34c09182ebe0ed2958aefa809159498923743d3.tar.gz
protobuf-e34c09182ebe0ed2958aefa809159498923743d3.tar.bz2
protobuf-e34c09182ebe0ed2958aefa809159498923743d3.zip
Improving the granularity parsing errors (#1623)
Add more context to GPBCodedInputStream failures. Have GPBMessage parsing apis extract out the GPBCodedInputStream information and expose it. Update HeaderDocs with pointers to all error domains/codes. Expand the unittests to cover the full set of errors reported. Fixes https://github.com/google/protobuf/issues/1618
Diffstat (limited to 'objectivec/GPBCodedInputStream.h')
-rw-r--r--objectivec/GPBCodedInputStream.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/objectivec/GPBCodedInputStream.h b/objectivec/GPBCodedInputStream.h
index 44f69906..df9d97ba 100644
--- a/objectivec/GPBCodedInputStream.h
+++ b/objectivec/GPBCodedInputStream.h
@@ -35,6 +35,39 @@
NS_ASSUME_NONNULL_BEGIN
+CF_EXTERN_C_BEGIN
+
+/// GPBCodedInputStream exception name. Exceptions raised from
+/// GPBCodedInputStream contain an underlying error in the userInfo dictionary
+/// under the GPBCodedInputStreamUnderlyingErrorKey key.
+extern NSString *const GPBCodedInputStreamException;
+
+/// The key under which the underlying NSError from the exception is stored.
+extern NSString *const GPBCodedInputStreamUnderlyingErrorKey;
+
+/// NSError domain used for GPBCodedInputStream errors.
+extern NSString *const GPBCodedInputStreamErrorDomain;
+
+/// Error code for NSError with GPBCodedInputStreamErrorDomain.
+typedef NS_ENUM(NSInteger, GPBCodedInputStreamErrorCode) {
+ /// The size does not fit in the remaining bytes to be read.
+ GPBCodedInputStreamErrorInvalidSize = -100,
+ /// Attempted to read beyond the subsection limit.
+ GPBCodedInputStreamErrorSubsectionLimitReached = -101,
+ /// The requested subsection limit is invalid.
+ GPBCodedInputStreamErrorInvalidSubsectionLimit = -102,
+ /// Invalid tag read.
+ GPBCodedInputStreamErrorInvalidTag = -103,
+ /// Invalid UTF-8 character in a string.
+ GPBCodedInputStreamErrorInvalidUTF8 = -104,
+ /// Invalid VarInt read.
+ GPBCodedInputStreamErrorInvalidVarInt = -105,
+ /// The maximum recursion depth of messages was exceeded.
+ GPBCodedInputStreamErrorRecursionDepthExceeded = -106,
+};
+
+CF_EXTERN_C_END
+
/// Reads and decodes protocol message fields.
///
/// The common uses of protocol buffers shouldn't need to use this class.