@azure-net/kit 6.0.0-next.10 → 6.0.0-next.11
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.
|
@@ -17,6 +17,7 @@ export interface IAppError<T = unknown> {
|
|
|
17
17
|
validation?: RequestErrors<T>;
|
|
18
18
|
external: boolean;
|
|
19
19
|
appErrorConvert?: boolean;
|
|
20
|
+
statusCode: number;
|
|
20
21
|
}
|
|
21
22
|
export declare class AppError<T = unknown> extends Error {
|
|
22
23
|
error: Error;
|
|
@@ -24,6 +25,7 @@ export declare class AppError<T = unknown> extends Error {
|
|
|
24
25
|
message: string;
|
|
25
26
|
external: boolean;
|
|
26
27
|
validation?: RequestErrors<T>;
|
|
28
|
+
statusCode: number;
|
|
27
29
|
constructor(error: Error);
|
|
28
30
|
tryToGetExternalError<HttpServiceDataType = unknown>(): HttpServiceError<HttpServiceDataType> | undefined;
|
|
29
31
|
redeclareValidation<D = T>(validation: D): void;
|
|
@@ -18,6 +18,7 @@ export class AppError extends Error {
|
|
|
18
18
|
message;
|
|
19
19
|
external = false;
|
|
20
20
|
validation;
|
|
21
|
+
statusCode = 500;
|
|
21
22
|
constructor(error) {
|
|
22
23
|
super(error.message);
|
|
23
24
|
this.error = error;
|
|
@@ -41,6 +42,7 @@ export class AppError extends Error {
|
|
|
41
42
|
external: this.external,
|
|
42
43
|
validation: this.validation,
|
|
43
44
|
appErrorConvert: true,
|
|
45
|
+
statusCode: this.statusCode,
|
|
44
46
|
...customData
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -49,10 +51,12 @@ export class AppError extends Error {
|
|
|
49
51
|
case this.error instanceof HttpServiceError:
|
|
50
52
|
this.type = ErrorTypes.Http;
|
|
51
53
|
this.external = this.error.type === HttpErrorTypes.External;
|
|
54
|
+
this.statusCode = this.error.status;
|
|
52
55
|
break;
|
|
53
56
|
case this.error instanceof SchemaFail:
|
|
54
57
|
this.type = ErrorTypes.Schema;
|
|
55
58
|
this.validation = this.error.getSelfTypedData();
|
|
59
|
+
this.statusCode = 422;
|
|
56
60
|
break;
|
|
57
61
|
case this.error instanceof AzureNetKitInternalError:
|
|
58
62
|
this.type = ErrorTypes.KitInternalError;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CreateServiceContainer } from './Provider.js';
|
|
2
|
-
const toProvider = (dependency) => typeof dependency === 'function' ? dependency : dependency.resolve;
|
|
2
|
+
const toProvider = (dependency) => (typeof dependency === 'function' ? dependency : dependency.resolve);
|
|
3
3
|
/** Holds registration metadata only. Resolving always uses the current request's container. */
|
|
4
4
|
export class CompositionRoot {
|
|
5
5
|
name = Symbol('@azure-net/kit:CompositionRoot');
|
package/package.json
CHANGED