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.
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent 7d50357684
commit d6d02053ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ui/app/ducks/swaps/swaps.js

@ -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))
} }

Loading…
Cancel
Save