Skip to content

Commit 450c528

Browse files
committed
Catch and rethrow from the lexer.
1 parent 219b5dc commit 450c528

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • src/main/java/co/casterlabs/rakurai/json

‎src/main/java/co/casterlabs/rakurai/json/Rson.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,12 @@ public <T> T fromJson(@NonNull char[] json, @NonNull Class<T> expected) throws J
162162
}
163163

164164
public <T> T fromJson(@NonNull char[] json, @NonNull TypeToken<T> token) throws JsonParseException, JsonValidationException {
165-
JsonElement e = JsonParser.parse(json);
166-
return this.fromJson(e, token);
165+
try {
166+
JsonElement e = JsonParser.parse(json);
167+
return this.fromJson(e, token);
168+
} catch (IllegalStateException | IllegalArgumentException e) {
169+
throw new JsonParseException(e);
170+
}
167171
}
168172

169173
public <T> T fromJson(@NonNull JsonElement e, @NonNull Class<T> expected) throws JsonParseException, JsonValidationException {

0 commit comments

Comments
 (0)