extracted hardcoded string in constant
This commit is contained in:
parent
517365353b
commit
f79834a30d
|
@ -1,6 +1,8 @@
|
||||||
const RunCode = require('./runCode.js');
|
const RunCode = require('./runCode.js');
|
||||||
const Utils = require('../../../utils/utils');
|
const Utils = require('../../../utils/utils');
|
||||||
|
|
||||||
|
const WEB3_INVALID_RESPONSE_ERROR = 'Invalid JSON RPC response';
|
||||||
|
|
||||||
class CodeRunner {
|
class CodeRunner {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.config = options.config;
|
this.config = options.config;
|
||||||
|
@ -94,7 +96,7 @@ class CodeRunner {
|
||||||
cb(null, value);
|
cb(null, value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Improve error message when there's no connection to node
|
// Improve error message when there's no connection to node
|
||||||
if (error.message.indexOf('Invalid JSON RPC response') !== -1) {
|
if (error.message.indexOf(WEB3_INVALID_RESPONSE_ERROR) !== -1) {
|
||||||
error.message += '. Are you connected to an Ethereum node?';
|
error.message += '. Are you connected to an Ethereum node?';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue