google / google/gson

JsonSyntaxException is used to wrap IOExceptions in fromJson instead of using JsonIOException

Open
#548 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
24.2k
Forks
4.5k
Avg merge
6d 4h
Merged PRs (30d)
12

Description

```
What steps will reproduce the problem?
1. call fromJson(JsonReader reader, Type typeOfT) while provoking an IOException

What is the expected output? What do you see instead?
The thrown exception will be a JsonSyntaxException instead of a JsonIOException.

What version of the product are you using? On what operating system?
com.google.code:gson:gson:2.2.2

Please provide any additional information below.
The JsonSyntaxException is clearly the wrong wrapper for an IOException,
because it makes it really awkward to differentiate network exceptions from
syntax exceptions. Network exceptions can be recovered from by retrying, while
syntax exceptions indicate a programming error on the client or server side.

```

Original issue reported on code.google.com by `s.groeb...@googlemail.com` on 13 Dec 2013 at 11:05

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.