diff options
| author | xackus <14938807+xackus@users.noreply.github.com> | 2019-10-27 21:52:28 +0100 |
|---|---|---|
| committer | xackus <14938807+xackus@users.noreply.github.com> | 2019-10-27 21:52:28 +0100 |
| commit | 36fa5fabc6402777ff3a806475d0b60f30edf389 (patch) | |
| tree | a6c776a573d48934db930b6f7acacb61f0437621 /lib | |
| parent | eeb6536c85c817bee2c137650ecfd941df20c38d (diff) | |
| download | zig-36fa5fabc6402777ff3a806475d0b60f30edf389.tar.gz zig-36fa5fabc6402777ff3a806475d0b60f30edf389.zip | |
rename error and specify it in function
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/json.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/json.zig b/lib/std/json.zig index b7f4c03168..18a9b31f2b 100644 --- a/lib/std/json.zig +++ b/lib/std/json.zig @@ -867,7 +867,7 @@ pub const TokenStream = struct { parser: StreamingParser, token: ?Token, - pub const Error = StreamingParser.Error || error.Incomplete; + pub const Error = StreamingParser.Error || error{UnexpectedEndOfJson}; pub fn init(slice: []const u8) TokenStream { return TokenStream{ @@ -878,7 +878,7 @@ pub const TokenStream = struct { }; } - pub fn next(self: *TokenStream) !?Token { + pub fn next(self: *TokenStream) Error!?Token { if (self.token) |token| { const copy = token; self.token = null; @@ -901,7 +901,7 @@ pub const TokenStream = struct { if(self.parser.complete){ return null; } else { - return error.Incomplete; + return error.UnexpectedEndOfJson; } } }; @@ -1456,5 +1456,5 @@ test "write json then parse it" { test "parsing empty string gives appropriate error" { var p = Parser.init(debug.global_allocator, false); defer p.deinit(); - testing.expectError(error.Incomplete, p.parse("")); + testing.expectError(error.UnexpectedEndOfJson, p.parse("")); } |
