1 |
|
2 | (function() {
|
3 | var InvalidResponseError, ReqError,
|
4 | __hasProp = {}.hasOwnProperty,
|
5 | __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
6 |
|
7 | ReqError = (function(_super) {
|
8 | __extends(ReqError, _super);
|
9 |
|
10 | function ReqError(resp) {
|
11 | this.name = "ReqError";
|
12 | if (resp.body.data.address.search(/valid address.*required/i >= 0)) {
|
13 | this.message = "Invalid address";
|
14 | } else {
|
15 | this.message = "Some API error occured";
|
16 | }
|
17 | this.resp = resp;
|
18 | }
|
19 |
|
20 | return ReqError;
|
21 |
|
22 | })(Error);
|
23 |
|
24 | InvalidResponseError = (function(_super) {
|
25 | __extends(InvalidResponseError, _super);
|
26 |
|
27 | function InvalidResponseError(opts) {
|
28 | this.name = "InvalidResponseError";
|
29 | this.message = opts.message || "Server response is invalid";
|
30 | this.response = opts.response;
|
31 | this.service = opts.service;
|
32 | }
|
33 |
|
34 | return InvalidResponseError;
|
35 |
|
36 | })(Error);
|
37 |
|
38 | module.exports = {
|
39 | "ReqError": ReqError,
|
40 | "InvalidResponseError": InvalidResponseError
|
41 | };
|
42 |
|
43 | }).call(this);
|