bitcore-wallet-service/lib/clienterror.js

26 lines
531 B
JavaScript
Raw Normal View History

2015-02-04 08:31:02 -08:00
function ClientError() {
var args = Array.prototype.slice.call(arguments);
switch (args.length) {
case 0:
this.code = 'BADREQUEST';
this.message = 'Bad request';
break;
case 1:
this.code = 'BADREQUEST';
this.message = args[0];
break;
default:
case 2:
this.code = args[0];
this.message = args[1];
break;
}
};
2015-02-23 09:09:04 -08:00
ClientError.prototype.toString = function() {
return '<ClientError:' + this.code + ' ' + this.message + '>';
};
2015-02-04 08:31:02 -08:00
module.exports = ClientError;