2015-03-22 17:12:52 +00:00
|
|
|
/*
|
2015-10-08 07:34:07 +00:00
|
|
|
This file is part of web3.js.
|
2015-03-22 17:12:52 +00:00
|
|
|
|
2015-10-08 07:34:07 +00:00
|
|
|
web3.js is free software: you can redistribute it and/or modify
|
2015-03-22 17:12:52 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
2015-10-08 07:34:07 +00:00
|
|
|
web3.js is distributed in the hope that it will be useful,
|
2015-03-22 17:12:52 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2015-10-08 07:34:07 +00:00
|
|
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
2015-03-22 17:12:52 +00:00
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file errors.js
|
|
|
|
* @author Marek Kotewicz <marek@ethdev.com>
|
|
|
|
* @date 2015
|
|
|
|
*/
|
|
|
|
|
|
|
|
module.exports = {
|
2015-04-16 09:11:33 +00:00
|
|
|
InvalidNumberOfParams: function () {
|
|
|
|
return new Error('Invalid number of input parameters');
|
|
|
|
},
|
|
|
|
InvalidConnection: function (host){
|
2015-10-14 21:07:59 +00:00
|
|
|
return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.');
|
2015-04-01 13:38:15 +00:00
|
|
|
},
|
2015-04-16 09:11:33 +00:00
|
|
|
InvalidProvider: function () {
|
2015-08-17 04:48:46 +00:00
|
|
|
return new Error('Provider not set or invalid');
|
2015-04-16 09:11:33 +00:00
|
|
|
},
|
|
|
|
InvalidResponse: function (result){
|
2015-10-12 06:23:16 +00:00
|
|
|
var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response: ' + JSON.stringify(result);
|
2015-03-23 17:26:48 +00:00
|
|
|
return new Error(message);
|
|
|
|
}
|
2015-03-22 17:12:52 +00:00
|
|
|
};
|
|
|
|
|