You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
546 B
28 lines
546 B
10 years ago
|
'use strict';
|
||
|
|
||
10 years ago
|
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;
|
||
|
}
|
||
|
};
|
||
|
|
||
10 years ago
|
ClientError.prototype.toString = function() {
|
||
|
return '<ClientError:' + this.code + ' ' + this.message + '>';
|
||
|
};
|
||
|
|
||
10 years ago
|
module.exports = ClientError;
|