-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Bubble API errors up. #588
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
Conversation
| return response; | ||
| }) | ||
| .then(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.
Linter wanted a blank line here 🙃
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 you move the comment to be outside of the .then() then the blank line before the comment will look nicer
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.
Better to update the linter to not complain about this when the comment in one level more indented than the previous line
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.
Couldn't find a rule in the linter that would make this pass. Ended up removing the comment, since (imo) it doesn't add a ton to this function overall
src/lib/API.js
Outdated
| networkRequestQueue.push({ | ||
| command, | ||
| data, | ||
| callback: resolve, |
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.
To make this code a little more consistent, rename callback to resolve.
src/lib/API.js
Outdated
| } | ||
|
|
||
| // Throw an error so we can pass the error up the chain | ||
| throw new 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.
Specify an error message with this error so it's not just a generic error.
src/lib/API.js
Outdated
| throw new Error(response.message); | ||
| } | ||
|
|
||
| // Update the authToken so it's used in the call to createLogin below |
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.
| // Update the authToken so it's used in the call to createLogin below | |
| // Update the authToken so it's used in the call to createLogin below |
| return response; | ||
| }) | ||
| .then(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.
If you move the comment to be outside of the .then() then the blank line before the comment will look nicer
src/lib/API.js
Outdated
| .finally(() => { | ||
| Ion.merge(IONKEYS.SESSION, {loading: false}); | ||
| }); |
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.
| .finally(() => { | |
| Ion.merge(IONKEYS.SESSION, {loading: false}); | |
| }); | |
| .finally(() => Ion.merge(IONKEYS.SESSION, {loading: false})); |
# Conflicts: # src/lib/API.js
|
Updated |
|
Updated |
marcaaron
left a comment
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.
LGTM
src/lib/API.js
Outdated
| } | ||
|
|
||
| // If we already have an error, throw that so we do not swallow it | ||
| if (error && error instanceof 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.
error && seems unnecessary
|
Updated, removed the extra check that wasn't needed |
# Conflicts: # src/lib/API.js
|
Merge conflicts resolved. |
Requested changes were made and Tim is OOO, dismissing
@marcaaron and @cead22 will you review please?
Fixed Issues
Fixes https://github.com/Expensify/Expensify/issues/142656
Tests
Screenshots
n/a