@napp/dti-client 4.3.4 → 4.4.2
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/errorhandle.d.ts +1 -1
- package/errorhandle.js +10 -4
- package/package.json +6 -4
package/errorhandle.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Exception } from "@napp/exception";
|
|
2
|
-
export declare function responseHandle<T>(resp: Response, parser?: (errObject: any) => Exception): Promise<T>;
|
|
2
|
+
export declare function responseHandle<T>(resp: Response, parser?: (errObject: any) => Exception | undefined): Promise<T>;
|
package/errorhandle.js
CHANGED
|
@@ -23,7 +23,7 @@ function responseHandle(resp, parser) {
|
|
|
23
23
|
}
|
|
24
24
|
catch (error) {
|
|
25
25
|
throw new exception_1.Exception(rsu, {
|
|
26
|
-
|
|
26
|
+
kind: 'serviceunavailable',
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -34,7 +34,13 @@ function responseHandle(resp, parser) {
|
|
|
34
34
|
try {
|
|
35
35
|
let errObject = JSON.parse(rsu);
|
|
36
36
|
if (parser) {
|
|
37
|
-
|
|
37
|
+
let e1 = parser(errObject);
|
|
38
|
+
if (e1) {
|
|
39
|
+
err = e1;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
err = exception_1.Exception.from(errObject);
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
else {
|
|
40
46
|
err = exception_1.Exception.from(errObject);
|
|
@@ -42,13 +48,13 @@ function responseHandle(resp, parser) {
|
|
|
42
48
|
}
|
|
43
49
|
catch (error) {
|
|
44
50
|
err = new exception_1.Exception(rsu, {
|
|
45
|
-
|
|
51
|
+
kind: 'serviceunavailable',
|
|
46
52
|
});
|
|
47
53
|
}
|
|
48
54
|
throw err;
|
|
49
55
|
}
|
|
50
56
|
throw new exception_1.Exception(`status=${resp.status}. ${resp.statusText}`, {
|
|
51
|
-
|
|
57
|
+
kind: 'serviceunavailable',
|
|
52
58
|
});
|
|
53
59
|
}
|
|
54
60
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napp/dti-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.2",
|
|
4
4
|
"description": "data transaction interface client library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
"author": "Farcek <farcek@gmail.com>",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@napp/
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
"@napp/dti-core": "4.4.2"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@napp/exception": "^9.1.4",
|
|
23
|
+
"cross-fetch": "^4.1.0"
|
|
22
24
|
}
|
|
23
25
|
}
|