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
request.perform fails despite Model being initialized with the desired json #69
Comments
Hi! |
Hi @DenTelezhkin , thanks. Subclassing with ErrorSerializable, like so,
Produces errors like:
When trying to print err.error or err.response. Additionally, shouldn't the request succeed, given that the Home object (a JSONDecodable) is initialized with the desired json? (This was checked by printing out the json upon initialization) Thank you again in advance. PS. In case this information serves, printing out the JSONError vars upon initialization:
Produces
|
Trying your other suggestion, subclassing APIError, did work! Thank you. (Still interested in what's wrong with the Errorserializable approach.) P.S. Thanks for your awesome work! |
I feel that probably It's possible I may revert this change and go back to throwing initializer or do something else to improve current behavior. I would like to keep this issue opened, if you don't mind, I want to think about it more. |
I changed I made a new beta release with this change and several others. Thanks for your feedback, it really showed me a flaw in my API design. 👍 |
@DenTelezhkin My pleasure! Thanks a lot for this awesome library and for the response. |
What did you do?
What did you expect to happen?
I expected the request to be successful and home.users.count to be printed. Especially because upon initialization of the home object, it successfully prints the desired json.
If it would fail, which it shouldn't, I expected the fail closure to give me information on the error (I'd think it would print eg. the error and response variables that the ErrorSerializable-conforming object err should have.
What happened instead?
I got this error:
Failed to fetch json, Projectname.HomeDatasourceController.JSONError
TRON Environment
TRON version: 5.0.0-beta.1'
Xcode version: 10.2
Swift version: 5
Platform(s) running TRON:
macOS version running Xcode: 10.14.3
Demo Project or sample code
ASAP
The text was updated successfully, but these errors were encountered: