| ... | ... | @@ -867,7 +867,7 @@ pub const TokenStream = struct { |
| 867 | 867 | parser: StreamingParser, |
| 868 | 868 | token: ?Token, |
| 869 | 869 | |
| 870 | | pub const Error = StreamingParser.Error || error.Incomplete; |
| 870 | pub const Error = StreamingParser.Error || error{UnexpectedEndOfJson}; |
| 871 | 871 | |
| 872 | 872 | pub fn init(slice: []const u8) TokenStream { |
| 873 | 873 | return TokenStream{ |
| ... | ... | @@ -878,7 +878,7 @@ pub const TokenStream = struct { |
| 878 | 878 | }; |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | | pub fn next(self: *TokenStream) !?Token { |
| 881 | pub fn next(self: *TokenStream) Error!?Token { |
| 882 | 882 | if (self.token) |token| { |
| 883 | 883 | const copy = token; |
| 884 | 884 | self.token = null; |
| ... | ... | @@ -901,7 +901,7 @@ pub const TokenStream = struct { |
| 901 | 901 | if(self.parser.complete){ |
| 902 | 902 | return null; |
| 903 | 903 | } else { |
| 904 | | return error.Incomplete; |
| 904 | return error.UnexpectedEndOfJson; |
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | 907 | }; |
| ... | ... | @@ -1456,5 +1456,5 @@ test "write json then parse it" { |
| 1456 | 1456 | test "parsing empty string gives appropriate error" { |
| 1457 | 1457 | var p = Parser.init(debug.global_allocator, false); |
| 1458 | 1458 | defer p.deinit(); |
| 1459 | | testing.expectError(error.Incomplete, p.parse("")); |
| 1459 | testing.expectError(error.UnexpectedEndOfJson, p.parse("")); |
| 1460 | 1460 | } |