1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Log when attempt to fetch quotes fails (#9723)

If the attempt to fetch quotes fails, an error message is now logged to
the console explaining why it failed. This makes it dramatically easier
to understand what's happening when quotes fail.

At some point later on we should also look specifically for errors we
expect to occur, and report to Sentry in unexpected cases. I've added a
TODO comment about this.
This commit is contained in:
Mark Stacey 2020-10-26 19:52:46 -02:30 committed by GitHub
parent 7d50357684
commit d6d02053ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -402,8 +402,11 @@ export const fetchQuotesAndSetQuoteState = (history, inputValue, maxSlippage, me
} catch (e) { } catch (e) {
// A newer swap request is running, so simply bail and let the newer request respond // A newer swap request is running, so simply bail and let the newer request respond
if (e.message === SWAPS_FETCH_ORDER_CONFLICT) { if (e.message === SWAPS_FETCH_ORDER_CONFLICT) {
log.debug(`Swap fetch order conflict detected; ignoring older request`)
return return
} }
// TODO: Check for any errors we should expect to occur in production, and report others to Sentry
log.error(`Error fetching quotes: `, e)
dispatch(setSwapsErrorKey(ERROR_FETCHING_QUOTES)) dispatch(setSwapsErrorKey(ERROR_FETCHING_QUOTES))
} }