attlaz-client 1.11.12 → 1.11.14
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/HttpClient.js
CHANGED
|
@@ -51,7 +51,9 @@ export class HttpClient {
|
|
|
51
51
|
jsonData = JSON.parse(rawData);
|
|
52
52
|
}
|
|
53
53
|
catch (e) {
|
|
54
|
-
console.error('Unable to parse response data to JSON', {
|
|
54
|
+
console.error('Unable to parse response data to JSON', {
|
|
55
|
+
statusText: httpResponse.statusText, error: e,
|
|
56
|
+
});
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
httpResponse.body = jsonData;
|
|
@@ -61,7 +63,8 @@ export class HttpClient {
|
|
|
61
63
|
}
|
|
62
64
|
const error = ClientError.byStatus(response.status, response.statusText);
|
|
63
65
|
if (error !== null && error !== undefined) {
|
|
64
|
-
|
|
66
|
+
console.log(httpResponse.body);
|
|
67
|
+
error.message = httpResponse.body.error.message;
|
|
65
68
|
throw error;
|
|
66
69
|
}
|
|
67
70
|
return httpResponse;
|
package/dist/Http/OAuthClient.js
CHANGED
|
@@ -105,11 +105,14 @@ export class OAuthClient {
|
|
|
105
105
|
return response.body;
|
|
106
106
|
}
|
|
107
107
|
catch (error) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
if (!(error instanceof ClientError)) {
|
|
109
|
+
const clientError = ClientError.fromError(error);
|
|
110
|
+
if (this.debug) {
|
|
111
|
+
console.error('[Client] Error:', { error, clientError });
|
|
112
|
+
}
|
|
113
|
+
throw clientError;
|
|
111
114
|
}
|
|
112
|
-
throw
|
|
115
|
+
throw error;
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export declare class ClientError implements Error {
|
|
2
|
-
message: string;
|
|
3
|
-
name: string;
|
|
4
2
|
code: number | null;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
constructor(
|
|
3
|
+
name: string;
|
|
4
|
+
message: string;
|
|
5
|
+
constructor(name: string, code?: number | null);
|
|
8
6
|
static fromError(error: Error | any): ClientError;
|
|
9
7
|
static byStatus(statusCode: number, statusText: string): ClientError | null;
|
|
10
8
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { HttpClient } from '../../Http/HttpClient.js';
|
|
2
2
|
export class ClientError {
|
|
3
|
-
message;
|
|
4
|
-
name;
|
|
5
3
|
code;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
name;
|
|
5
|
+
message;
|
|
6
|
+
// description: string | null;
|
|
7
|
+
// stack: string;
|
|
8
|
+
// body: string | null = null;
|
|
9
|
+
constructor(name, code = null) {
|
|
10
|
+
this.name = name;
|
|
11
|
+
this.message = name;
|
|
10
12
|
this.code = code;
|
|
11
13
|
}
|
|
12
14
|
static fromError(error) {
|
|
15
|
+
console.log(error);
|
|
13
16
|
if (error.body !== undefined && error.body !== null && error.body.error !== undefined && error.body.error !== null) {
|
|
14
17
|
error = error.body.error;
|
|
15
18
|
}
|
|
@@ -42,7 +45,7 @@ export class ClientError {
|
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
clientError.name = error.name;
|
|
45
|
-
clientError.stack = error.stack;
|
|
48
|
+
// clientError.stack = error.stack;
|
|
46
49
|
return clientError;
|
|
47
50
|
}
|
|
48
51
|
static byStatus(statusCode, statusText) {
|
|
@@ -3,5 +3,6 @@ import { Workspace } from '../Model/Workspace/Workspace.js';
|
|
|
3
3
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
4
4
|
export declare class WorkspaceEndpoint extends Endpoint {
|
|
5
5
|
getAll(): Promise<CollectionResult<Workspace>>;
|
|
6
|
+
getById(workspaceId: string): Promise<Workspace | null>;
|
|
6
7
|
save(workspace: Workspace): Promise<Workspace>;
|
|
7
8
|
}
|
|
@@ -13,6 +13,19 @@ export class WorkspaceEndpoint extends Endpoint {
|
|
|
13
13
|
throw e;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
async getById(workspaceId) {
|
|
17
|
+
try {
|
|
18
|
+
const url = '/workspaces/' + workspaceId + '';
|
|
19
|
+
const result = await this.requestObject(url, null, Workspace.parse);
|
|
20
|
+
return result.getData();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
24
|
+
console.error('Failed to load workspace by id: ', error);
|
|
25
|
+
}
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
16
29
|
async save(workspace) {
|
|
17
30
|
try {
|
|
18
31
|
const url = '/workspaces';
|