diff --git a/lib/core/modules/coderunner/codeRunner.js b/lib/core/modules/coderunner/codeRunner.js index 2761319d..e4004da4 100644 --- a/lib/core/modules/coderunner/codeRunner.js +++ b/lib/core/modules/coderunner/codeRunner.js @@ -1,6 +1,8 @@ const RunCode = require('./runCode.js'); const Utils = require('../../../utils/utils'); +const WEB3_INVALID_RESPONSE_ERROR = 'Invalid JSON RPC response'; + class CodeRunner { constructor(options) { this.config = options.config; @@ -94,7 +96,7 @@ class CodeRunner { cb(null, value); } catch (error) { // 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?'; }