Handle Signer Rejection // Real Custom Errors #3153

This commit is contained in:
Nicolas Gotchac
2016-11-16 18:55:53 +01:00
parent 18f570327e
commit 7144da5d7e
8 changed files with 151 additions and 17 deletions

View File

@@ -16,6 +16,7 @@
import { Logging } from '../../subscriptions';
import JsonRpcBase from '../jsonRpcBase';
import TransportError from '../error';
/* global fetch */
export default class Http extends JsonRpcBase {
@@ -73,7 +74,8 @@ export default class Http extends JsonRpcBase {
this.error(JSON.stringify(response));
console.error(`${method}(${JSON.stringify(params)}): ${response.error.code}: ${response.error.message}`);
throw new Error(`${method}: ${response.error.code}: ${response.error.message}`);
const error = new TransportError(method, response.error.code, response.error.message);
throw error;
}
this.log(JSON.stringify(response));