Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapping any exception in deserialization process #704

Closed
krupt opened this issue Feb 14, 2020 · 0 comments
Closed

Wrapping any exception in deserialization process #704

krupt opened this issue Feb 14, 2020 · 0 comments
Assignees

Comments

@krupt
Copy link

krupt commented Feb 14, 2020

Example model:

@Serializable
data class Model(
    val id: Long
)
json.parse("""
{
    "id": ""
}
""")

throws java.lang.NumberFormatException: For input string: ""

json.parse("""
{
    "id": "
}
""")

throws java.lang.StringIndexOutOfBoundsException: String index out of range: 99

I think the better is catching any exception in deserialization process and wrapping it into SerializationException or a new one (for example: JsonParseException).
What do you think?

@krupt krupt added the feature label Feb 14, 2020
sandwwraith pushed a commit that referenced this issue Aug 31, 2020
… input (#1011)

This PR fixes a bug where an unfinished string literal at the end of the input throws a StringIndexOutOfBoundsException instead of a JsonDecodingException.

Similar to #704, this should be a generic decoding exception instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants