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

Easily Crash when JSON response wrong format or null ! #99

Open
buidinhduong opened this issue Jun 29, 2017 · 4 comments
Open

Easily Crash when JSON response wrong format or null ! #99

buidinhduong opened this issue Jun 29, 2017 · 4 comments

Comments

@buidinhduong
Copy link

Easily Crash when JSON response wrong format or null field !

Please check & improve this .
Also, Lib should provide a way to handle error manually or document how to handle response error ?

Thank you

@buidinhduong buidinhduong changed the title Easily Crash when JSON response wrong format of null ! Easily Crash when JSON response wrong format or null ! Jun 29, 2017
@dimazen
Copy link
Contributor

dimazen commented Jun 29, 2017

Hello, @buidinhduong! Thanks for your report!

Can you provide please sample JSON and a mapping?

@buidinhduong
Copy link
Author

-[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000013
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance

@buidinhduong
Copy link
Author

this crash may occur if server response wrong format type. example :
if my class have age: Int but respone respone ["age":""]

@dimazen
Copy link
Contributor

dimazen commented Jul 10, 2017

Sorry for not getting back for such a long time.

Errors handling is in the plans. However incorrect types can not be handled or converted automatically. FEM assumes that your types are consistent. Looks like that the backend returns types incorrectly which is not subject for this library. But for sure we need to return a correct error.

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