Handle Shapeshift Error Messages (#811)
* Add error message if exists in shapeshift * console error if shapeshiftOrderCreateFailed and bityOrderCreateFailed * check e before checking e.message * Handle preflight rejections. Put failure on any error.
This commit is contained in:
parent
fa8fbe531f
commit
9ee764be2e
|
@ -53,7 +53,15 @@ class ShapeshiftService {
|
|||
headers: new Headers(this.postHeaders)
|
||||
})
|
||||
.then(checkHttpStatus)
|
||||
.then(parseJSON);
|
||||
.then(parseJSON)
|
||||
.catch(err => {
|
||||
// CORS rejection, meaning metamask don't want us
|
||||
if (err.name === 'TypeError') {
|
||||
throw new Error(
|
||||
'Shapeshift has blocked this request, visit shapeshift.io for more information or contact support'
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public getCoins() {
|
||||
|
|
|
@ -156,6 +156,7 @@ export function* postBityOrderCreate(action: BityOrderCreateRequestedSwapAction)
|
|||
} catch (e) {
|
||||
const message =
|
||||
'Connection Error. Please check the developer console for more details and/or contact support';
|
||||
console.error(e);
|
||||
yield put(showNotification('danger', message, TEN_SECONDS));
|
||||
yield put(bityOrderCreateFailedSwap());
|
||||
}
|
||||
|
@ -185,9 +186,14 @@ export function* postShapeshiftOrderCreate(
|
|||
yield put(startPollShapeshiftOrderStatus());
|
||||
}
|
||||
} catch (e) {
|
||||
const message =
|
||||
'Connection Error. Please check the developer console for more details and/or contact support';
|
||||
yield put(showNotification('danger', message, TEN_SECONDS));
|
||||
if (e && e.message) {
|
||||
yield put(showNotification('danger', e.message, TEN_SECONDS));
|
||||
} else {
|
||||
const message =
|
||||
'Connection Error. Please check the developer console for more details and/or contact support';
|
||||
console.error(e);
|
||||
yield put(showNotification('danger', message, TEN_SECONDS));
|
||||
}
|
||||
yield put(shapeshiftOrderCreateFailedSwap());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue