ismx-nexo-node-app 0.3.57 → 0.3.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js/repository/RepositoryRest.js +4 -0
- package/dist/js/repository/RepositoryRestFormal.js +1 -1
- package/dist/types/repository/RepositoryRest.d.ts +1 -0
- package/package.json +1 -1
- package/src/main/node/repository/RepositoryRest.ts +4 -0
- package/src/main/node/repository/RepositoryRestFormal.ts +1 -1
|
@@ -48,6 +48,10 @@ class RepositoryRest extends Repository_1.default {
|
|
|
48
48
|
};
|
|
49
49
|
(_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.onResponse) === null || _b === void 0 ? void 0 : _b.call(_a, response);
|
|
50
50
|
return response;
|
|
51
|
+
}).catch((error) => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
(_b = (_a = this.options).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
54
|
+
throw error;
|
|
51
55
|
});
|
|
52
56
|
});
|
|
53
57
|
}
|
|
@@ -35,7 +35,7 @@ class RepositoryRestFormal extends RepositoryRest_1.default {
|
|
|
35
35
|
return {};
|
|
36
36
|
}))
|
|
37
37
|
.catch((error) => {
|
|
38
|
-
throw { id: "-1", code: "-1", description: "ConnectionError", error };
|
|
38
|
+
throw { id: "-1", code: "-1", description: "ConnectionError", error: error.getMessage() };
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -3,6 +3,7 @@ import { HttpRequest, HttpResponse } from "../api/Service";
|
|
|
3
3
|
export interface RestOptions {
|
|
4
4
|
interceptor?: (endpoint: string, request: HttpRequest) => HttpRequest | undefined;
|
|
5
5
|
onResponse?: (response: HttpResponse) => void;
|
|
6
|
+
onError?: (error: Error) => void;
|
|
6
7
|
}
|
|
7
8
|
export default class RepositoryRest<Body = any, Res = any> extends Repository {
|
|
8
9
|
private readonly baseUrl;
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import QueryUtils from "./utils/QueryUtils";
|
|
|
5
5
|
export interface RestOptions {
|
|
6
6
|
interceptor?: (endpoint: string, request: HttpRequest) => HttpRequest | undefined
|
|
7
7
|
onResponse?: (response: HttpResponse) => void;
|
|
8
|
+
onError?: (error: Error) => void
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export default class RepositoryRest<Body=any,Res=any> extends Repository
|
|
@@ -57,6 +58,9 @@ export default class RepositoryRest<Body=any,Res=any> extends Repository
|
|
|
57
58
|
};
|
|
58
59
|
this.options?.onResponse?.(response);
|
|
59
60
|
return response;
|
|
61
|
+
}).catch((error) => {
|
|
62
|
+
this.options.onError?.(error);
|
|
63
|
+
throw error;
|
|
60
64
|
});
|
|
61
65
|
}
|
|
62
66
|
|
|
@@ -24,7 +24,7 @@ export default class RepositoryRestFormal<Body=any, S=any> extends RepositoryRes
|
|
|
24
24
|
} else return {} as E;
|
|
25
25
|
})
|
|
26
26
|
.catch((error) => {
|
|
27
|
-
throw { id: "-1", code: "-1", description: "ConnectionError", error } as FormalError
|
|
27
|
+
throw { id: "-1", code: "-1", description: "ConnectionError", error: error.getMessage() } as FormalError
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
}
|