attlaz-client 1.73.1 → 1.74.0
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
|
@@ -9,6 +9,12 @@ export class ClientError extends Error {
|
|
|
9
9
|
this.httpStatus = httpErrorCode;
|
|
10
10
|
}
|
|
11
11
|
static fromError(error) {
|
|
12
|
+
// Already a ClientError (or a subclass such as ApiError) — preserve it as-is.
|
|
13
|
+
// Re-deriving here would discard its httpStatus, because this method inspects the
|
|
14
|
+
// `.status`/`.code` shape of raw transport errors, not ClientError's own fields.
|
|
15
|
+
if (error instanceof ClientError) {
|
|
16
|
+
return error;
|
|
17
|
+
}
|
|
12
18
|
let clientError = new ClientError('Unknown error', HttpStatus.HTTP_INTERNAL_SERVER_ERROR);
|
|
13
19
|
const xError = error;
|
|
14
20
|
if (xError.status !== null && xError.status !== undefined) {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ClientError } from '../../Http/ClientError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Domain-level error produced at the API/Endpoint boundary. Extends ClientError so a single
|
|
4
|
+
* `instanceof ClientError` catches both transport failures (ClientError) and API errors
|
|
5
|
+
* (ApiError), while adding the server's structured error fields (type/code/param).
|
|
6
|
+
*
|
|
7
|
+
* httpStatus, message and response are inherited from ClientError.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ApiError extends ClientError {
|
|
3
10
|
type: string;
|
|
4
11
|
code: string;
|
|
5
12
|
param?: string | undefined;
|
|
6
|
-
stack?: string;
|
|
7
|
-
message: string;
|
|
8
|
-
response: unknown;
|
|
9
13
|
constructor(message: string, httpErrorCode?: number | null);
|
|
10
14
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ClientError } from '../../Http/ClientError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Domain-level error produced at the API/Endpoint boundary. Extends ClientError so a single
|
|
4
|
+
* `instanceof ClientError` catches both transport failures (ClientError) and API errors
|
|
5
|
+
* (ApiError), while adding the server's structured error fields (type/code/param).
|
|
6
|
+
*
|
|
7
|
+
* httpStatus, message and response are inherited from ClientError.
|
|
8
|
+
*/
|
|
9
|
+
export class ApiError extends ClientError {
|
|
3
10
|
type;
|
|
4
11
|
code;
|
|
5
|
-
// public message: string;
|
|
6
12
|
param = undefined;
|
|
7
|
-
stack;
|
|
8
|
-
message;
|
|
9
|
-
response;
|
|
10
13
|
constructor(message, httpErrorCode = null) {
|
|
11
|
-
super(message);
|
|
12
|
-
this.message = message;
|
|
13
|
-
this.httpStatus = httpErrorCode;
|
|
14
|
+
super(message, httpErrorCode);
|
|
14
15
|
}
|
|
15
16
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { OAuthClient } from './Http/Transport/OAuthClient.js';
|
|
|
14
14
|
export { OAuthClientOptions } from './Http/OAuthClientOptions.js';
|
|
15
15
|
export { OAuthClientToken } from './Http/OAuthClientToken.js';
|
|
16
16
|
export { ClientError } from './Http/ClientError.js';
|
|
17
|
+
export { ApiError } from './Model/Error/ApiError.js';
|
|
17
18
|
export { HttpStatus } from './Http/HttpStatus.js';
|
|
18
19
|
export { ContentTypeHelper } from './Http/ContentTypeHelper.js';
|
|
19
20
|
/**
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { OAuthClient } from './Http/Transport/OAuthClient.js';
|
|
|
7
7
|
export { OAuthClientOptions } from './Http/OAuthClientOptions.js';
|
|
8
8
|
export { OAuthClientToken } from './Http/OAuthClientToken.js';
|
|
9
9
|
export { ClientError } from './Http/ClientError.js';
|
|
10
|
+
export { ApiError } from './Model/Error/ApiError.js';
|
|
10
11
|
export { HttpStatus } from './Http/HttpStatus.js';
|
|
11
12
|
export { ContentTypeHelper } from './Http/ContentTypeHelper.js';
|
|
12
13
|
/**
|