-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
TokenService improvements #541
Conversation
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
we need this for every api endpoint, eh? |
please verify my changes are sound around |
async function parseJsonResponse(apiResponse: Response): Promise<unknown> { | ||
const responseObj = await apiResponse.json(); | ||
// api may return errors as json without setting an error http status code | ||
if (responseObj?.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.
nit: Is the ?
necessary given we are checking for the props existence in the first place?
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.
responseObj could be null, thats valid json
unlikely tho
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
…to dynamic-speed-up * 'dynamic-speed-up' of github.com:MetaMask/controllers: Bump @metamask/auto-changelog from 2.4.0 to 2.5.0 (#549) Update Changelog (#548) 14.0.2 (#547) Fix `resetPolling` functionality (#546) TokenService improvements (#541) Release/14.0.1 (#545) Make gweiDecToWEIBN util resilient against params with too many decimals (#544) Bump @metamask/contract-metadata from 1.27.0 to 1.28.0 (#540) 14.0.0 (#539) Bug: Mainnet NFT Autodetect API (#536)
* Update token-service.ts * Update token-service.ts * Update token-service.ts * lint fix * token-service - break out parsing of response to only those that have a response * TokenListController - fallback to empty array * TokenListController - remove unsound safety wrapper * TokenListController - fix endpoint for token lookup * lint fix
* Update token-service.ts * Update token-service.ts * Update token-service.ts * lint fix * token-service - break out parsing of response to only those that have a response * TokenListController - fallback to empty array * TokenListController - remove unsound safety wrapper * TokenListController - fix endpoint for token lookup * lint fix
we should check for that an elevate to an error
safelyExecute
usagesafelyExecute
usagei guess this is a breaking change bc types?