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

Wrap NumberFormatException as SerializationException #779

Closed
vanniktech opened this issue Mar 27, 2020 · 3 comments
Closed

Wrap NumberFormatException as SerializationException #779

vanniktech opened this issue Mar 27, 2020 · 3 comments

Comments

@vanniktech
Copy link

Describe the bug

When parsing a JSON with an invalid number you get a NumberFormatException.

To Reproduce

Parse a JSON where a Number is expected but use a string. {"integer": "test"}
Now this will throw a NumberFormatException

Expected behavior

Throw a SerializationException & pass along the NumberFormatException as the throwable

Environment

  • Kotlin version: 1.3.60
  • Library version: 0.14.0
  • Kotlin platforms: JVM
  • Gradle version: 6.2
@sandwwraith
Copy link
Member

I think this is a duplicate of #704 and was fixed in 0.20.0. Have you tried it?

@vanniktech
Copy link
Author

I haven't since 0.20.0 depends on Kotlin 1.3.71 and a bunch of my dependencies haven't updated :/
The commit looks good though, so feel free to close. For now I'm catching Throwable

@vanniktech
Copy link
Author

I've updated to 0.20.0 and things are looking good. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants