-
Notifications
You must be signed in to change notification settings - Fork 0
feature/SCKT-3_Adding_error_messages_object_for_422_status_code #4
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
base: main
Are you sure you want to change the base?
feature/SCKT-3_Adding_error_messages_object_for_422_status_code #4
Conversation
src/ApiKitClient.ts
Outdated
| if (status === 401 && this.unauthorizationCallback) { | ||
| this.unauthorizationCallback(); | ||
| } | ||
| if (this.globalErrorCallback) { |
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.
should it be elseif ?
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.
Yes you are right, I started with like this at 1st but I changed it accidentally later!
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.
Done! ✅
src/ApiKitClient.ts
Outdated
| this.unauthorizationCallback(); | ||
| } | ||
| if (this.globalErrorCallback) { | ||
| this.globalErrorCallback(); |
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.
you might need to pass the error object
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.
Didn't get passing error object where...?
src/ApiKitClient.ts
Outdated
| if (status === 401 && this.unauthorizationCallback) { | ||
| this.unauthorizationCallback(); | ||
| } else if (this.globalErrorCallback) { | ||
| this.globalErrorCallback(); |
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.
Like this
| this.globalErrorCallback(); | |
| this.globalErrorCallback(error); |
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.
This is a callback doesn't accept any parameter why should I pass the error object to it?!
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.
@MostafaFawzy7 to let the consumer know what exactly happened. Give the consuming app some context. This is actually a pretty good idea.
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.
@HassanElZarkawy The idea of this callback is to add a custom error by the consumer at the global scope of error handling, why to pass to it the error object which is already exposed by the Promise rejection at the next line of this condition?
|
Did you test it locally by linking? |
Why? Do you have an issue with it? it's just a condition to invoke the new callback... |
I didn't test it and was asking if you did |
@SirNarsh @HassanElZarkawy @amrography Done as we agreed on this finally on the standup! |
No description provided.