authorgravatar for 14938807+xackus@users.noreply.github.comxackus <14938807+xackus@users.noreply.github.com> 2019-10-27 21:52:28+01:00
committergravatar for 14938807+xackus@users.noreply.github.comxackus <14938807+xackus@users.noreply.github.com> 2019-10-27 21:52:28+01:00
log36fa5fabc6402777ff3a806475d0b60f30edf389
treea6c776a573d48934db930b6f7acacb61f0437621
parenteeb6536c85c817bee2c137650ecfd941df20c38d

rename error and specify it in function


1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/json.zig+4-4
......@@ -867,7 +867,7 @@ pub const TokenStream = struct {
867867 parser: StreamingParser,
868868 token: ?Token,
869869
870 pub const Error = StreamingParser.Error || error.Incomplete;
870 pub const Error = StreamingParser.Error || error{UnexpectedEndOfJson};
871871
872872 pub fn init(slice: []const u8) TokenStream {
873873 return TokenStream{
......@@ -878,7 +878,7 @@ pub const TokenStream = struct {
878878 };
879879 }
880880
881 pub fn next(self: *TokenStream) !?Token {
881 pub fn next(self: *TokenStream) Error!?Token {
882882 if (self.token) |token| {
883883 const copy = token;
884884 self.token = null;
......@@ -901,7 +901,7 @@ pub const TokenStream = struct {
901901 if(self.parser.complete){
902902 return null;
903903 } else {
904 return error.Incomplete;
904 return error.UnexpectedEndOfJson;
905905 }
906906 }
907907};
......@@ -1456,5 +1456,5 @@ test "write json then parse it" {
14561456test "parsing empty string gives appropriate error" {
14571457 var p = Parser.init(debug.global_allocator, false);
14581458 defer p.deinit();
1459 testing.expectError(error.Incomplete, p.parse(""));
1459 testing.expectError(error.UnexpectedEndOfJson, p.parse(""));
14601460}