-
Notifications
You must be signed in to change notification settings - Fork 192
feat-custom-exception-model #113
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
feat-custom-exception-model #113
Conversation
| class {{spec.title | caseUcfirst}}Exception implements Exception { | ||
| final String message; | ||
| final int code; | ||
| final dynamic response; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we maybe have a specific type here? 🤔
String maybe?
Map<String, dynamic> is fine as well, but as a mobile developer who is coming from strongly typed languages like kotlin, java or swift I like having types 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the response can be different in some cases it's fine to have dynamic but then I would add a little comment to it. In our case, we are casting to some type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the response can be Json or can be String as well. @eldadfux do you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh It might be tricky because sometimes a proxy can throw the error and we can't be sure of the format.
| } | ||
| } on DioError catch(e) { | ||
| if(e.response == null) { | ||
| throw {{spec.title | caseUcfirst}}AppwriteException(e.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line in the Exceptions PR is wrong: throw {{spec.title | caseUcfirst}}AppwriteException(e.message); as it resolve to AppwriteAppwriteException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah !
No description provided.