attlaz-client 1.18.9 → 1.18.10
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/Http/ClientError.js
CHANGED
|
@@ -4,7 +4,7 @@ export class ClientError extends Error {
|
|
|
4
4
|
httpStatus = null;
|
|
5
5
|
type;
|
|
6
6
|
code;
|
|
7
|
-
message;
|
|
7
|
+
// public message: string;
|
|
8
8
|
param = undefined;
|
|
9
9
|
stack;
|
|
10
10
|
constructor(code, httpErrorCode = null) {
|
|
@@ -25,22 +25,36 @@ export class ClientError extends Error {
|
|
|
25
25
|
clientError.code = error.code;
|
|
26
26
|
}
|
|
27
27
|
if (error.response === undefined) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
else {
|
|
31
|
-
// console.debug('Parse response', {error: error, data: error.response.data});
|
|
32
|
-
const errorData = error.response.data;
|
|
33
|
-
if (errorData.type !== undefined) {
|
|
34
|
-
clientError.type = errorData.type;
|
|
28
|
+
if (error.code === 'ECONNREFUSED') {
|
|
29
|
+
clientError.message = 'Connection refused';
|
|
35
30
|
}
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
else {
|
|
32
|
+
console.error('Unable to parse AxiosError response', { error, x: error.status, y: error.code });
|
|
38
33
|
}
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// console.debug('Parse response', {error: error, data: error.response.data});
|
|
37
|
+
switch (error.response.status) {
|
|
38
|
+
case 404:
|
|
39
|
+
clientError.code = 'Not found';
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const errorData = error.response.data;
|
|
44
|
+
if (errorData.error !== undefined) {
|
|
45
|
+
// console.debug('Error data', errorData);
|
|
46
|
+
if (errorData.error.type !== undefined) {
|
|
47
|
+
clientError.type = errorData.error.type;
|
|
48
|
+
}
|
|
49
|
+
if (errorData.error.code !== undefined) {
|
|
50
|
+
clientError.code = errorData.error.code;
|
|
51
|
+
}
|
|
52
|
+
if (errorData.error.message !== undefined) {
|
|
53
|
+
clientError.message = errorData.error.message;
|
|
54
|
+
}
|
|
55
|
+
if (errorData.error.param !== undefined) {
|
|
56
|
+
clientError.param = errorData.error.param;
|
|
57
|
+
}
|
|
44
58
|
}
|
|
45
59
|
}
|
|
46
60
|
return clientError;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Endpoint } from './Endpoint.js';
|
|
2
1
|
import { ProjectEnvironment } from '../Model/Project/ProjectEnvironment.js';
|
|
3
2
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
4
3
|
import { ProjectEnvironmentConfiguration } from '../Model/Project/ProjectEnvironmentConfiguration.js';
|
|
4
|
+
import { Endpoint } from './Endpoint.js';
|
|
5
5
|
export declare class ProjectEnvironmentEndpoint extends Endpoint {
|
|
6
6
|
getByProject(id: string): Promise<CollectionResult<ProjectEnvironment>>;
|
|
7
7
|
getById(id: string): Promise<ProjectEnvironment | null>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Endpoint } from './Endpoint.js';
|
|
2
1
|
import { ProjectEnvironment } from '../Model/Project/ProjectEnvironment.js';
|
|
3
2
|
import { ProjectEnvironmentConfiguration } from '../Model/Project/ProjectEnvironmentConfiguration.js';
|
|
4
3
|
import { HttpStatus } from '../Http/HttpStatus.js';
|
|
4
|
+
import { Endpoint } from './Endpoint.js';
|
|
5
5
|
export class ProjectEnvironmentEndpoint extends Endpoint {
|
|
6
6
|
async getByProject(id) {
|
|
7
7
|
try {
|