diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2017-06-19 10:21:33 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2017-06-19 10:33:45 -0400 |
commit | 5fd71ce6312e6d7620f1f443d4181629695733a4 (patch) | |
tree | 8efd87a31e9e2e6f722365cd3a35b19c9162e578 /objectivec/GPBCodedOutputStream.m | |
parent | 72e293a28f4be911b9dd7c79836e32a9b2b6e09d (diff) | |
download | protobuf-5fd71ce6312e6d7620f1f443d4181629695733a4.tar.gz protobuf-5fd71ce6312e6d7620f1f443d4181629695733a4.tar.bz2 protobuf-5fd71ce6312e6d7620f1f443d4181629695733a4.zip |
ObjC: Document the exceptions on some of the writing apis.
Diffstat (limited to 'objectivec/GPBCodedOutputStream.m')
-rw-r--r-- | objectivec/GPBCodedOutputStream.m | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/objectivec/GPBCodedOutputStream.m b/objectivec/GPBCodedOutputStream.m index 7c3ab447..c299040f 100644 --- a/objectivec/GPBCodedOutputStream.m +++ b/objectivec/GPBCodedOutputStream.m @@ -36,6 +36,11 @@ #import "GPBUnknownFieldSet_PackagePrivate.h" #import "GPBUtilities_PackagePrivate.h" +// These values are the existing values so as not to break any code that might +// have already been inspecting them when they weren't documented/exposed. +NSString *const GPBCodedOutputStreamException_OutOfSpace = @"OutOfSpace"; +NSString *const GPBCodedOutputStreamException_WriteFailed = @"WriteFailed"; + // Structure for containing state of a GPBCodedInputStream. Brought out into // a struct so that we can inline several common functions instead of dealing // with overhead of ObjC dispatch. @@ -59,13 +64,13 @@ static const int32_t LITTLE_ENDIAN_64_SIZE = sizeof(uint64_t); static void GPBRefreshBuffer(GPBOutputBufferState *state) { if (state->output == nil) { // We're writing to a single buffer. - [NSException raise:@"OutOfSpace" format:@""]; + [NSException raise:GPBCodedOutputStreamException_OutOfSpace format:@""]; } if (state->position != 0) { NSInteger written = [state->output write:state->bytes maxLength:state->position]; if (written != (NSInteger)state->position) { - [NSException raise:@"WriteFailed" format:@""]; + [NSException raise:GPBCodedOutputStreamException_WriteFailed format:@""]; } state->position = 0; } |