@rexezuge/errors 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/dist/BadGatewayError.d.ts +10 -0
- package/dist/BadGatewayError.d.ts.map +1 -0
- package/dist/BadGatewayError.js +12 -0
- package/dist/BadGatewayError.js.map +1 -0
- package/dist/BadRequestError.d.ts +9 -0
- package/dist/BadRequestError.d.ts.map +1 -0
- package/dist/BadRequestError.js +11 -0
- package/dist/BadRequestError.js.map +1 -0
- package/dist/CATALOG.d.ts +108 -0
- package/dist/CATALOG.d.ts.map +1 -0
- package/dist/CATALOG.js +92 -0
- package/dist/CATALOG.js.map +1 -0
- package/dist/ConflictError.d.ts +10 -0
- package/dist/ConflictError.d.ts.map +1 -0
- package/dist/ConflictError.js +12 -0
- package/dist/ConflictError.js.map +1 -0
- package/dist/DatabaseError.d.ts +16 -0
- package/dist/DatabaseError.d.ts.map +1 -0
- package/dist/DatabaseError.js +18 -0
- package/dist/DatabaseError.js.map +1 -0
- package/dist/ErrorResponse.d.ts +16 -0
- package/dist/ErrorResponse.d.ts.map +1 -0
- package/dist/ErrorResponse.js +2 -0
- package/dist/ErrorResponse.js.map +1 -0
- package/dist/ForbiddenError.d.ts +9 -0
- package/dist/ForbiddenError.d.ts.map +1 -0
- package/dist/ForbiddenError.js +11 -0
- package/dist/ForbiddenError.js.map +1 -0
- package/dist/HttpServiceError.d.ts +14 -0
- package/dist/HttpServiceError.d.ts.map +1 -0
- package/dist/HttpServiceError.js +16 -0
- package/dist/HttpServiceError.js.map +1 -0
- package/dist/InternalServerError.d.ts +16 -0
- package/dist/InternalServerError.d.ts.map +1 -0
- package/dist/InternalServerError.js +16 -0
- package/dist/InternalServerError.js.map +1 -0
- package/dist/MethodNotAllowedError.d.ts +9 -0
- package/dist/MethodNotAllowedError.d.ts.map +1 -0
- package/dist/MethodNotAllowedError.js +11 -0
- package/dist/MethodNotAllowedError.js.map +1 -0
- package/dist/NotFoundError.d.ts +9 -0
- package/dist/NotFoundError.d.ts.map +1 -0
- package/dist/NotFoundError.js +11 -0
- package/dist/NotFoundError.js.map +1 -0
- package/dist/NotImplementedError.d.ts +9 -0
- package/dist/NotImplementedError.d.ts.map +1 -0
- package/dist/NotImplementedError.js +11 -0
- package/dist/NotImplementedError.js.map +1 -0
- package/dist/OutcomeError.d.ts +41 -0
- package/dist/OutcomeError.d.ts.map +1 -0
- package/dist/OutcomeError.js +50 -0
- package/dist/OutcomeError.js.map +1 -0
- package/dist/PayloadTooLargeError.d.ts +9 -0
- package/dist/PayloadTooLargeError.d.ts.map +1 -0
- package/dist/PayloadTooLargeError.js +11 -0
- package/dist/PayloadTooLargeError.js.map +1 -0
- package/dist/PreconditionFailedError.d.ts +10 -0
- package/dist/PreconditionFailedError.d.ts.map +1 -0
- package/dist/PreconditionFailedError.js +12 -0
- package/dist/PreconditionFailedError.js.map +1 -0
- package/dist/RateLimitedError.d.ts +10 -0
- package/dist/RateLimitedError.d.ts.map +1 -0
- package/dist/RateLimitedError.js +12 -0
- package/dist/RateLimitedError.js.map +1 -0
- package/dist/ServiceError.d.ts +63 -0
- package/dist/ServiceError.d.ts.map +1 -0
- package/dist/ServiceError.js +84 -0
- package/dist/ServiceError.js.map +1 -0
- package/dist/ServiceUnavailableError.d.ts +10 -0
- package/dist/ServiceUnavailableError.d.ts.map +1 -0
- package/dist/ServiceUnavailableError.js +12 -0
- package/dist/ServiceUnavailableError.js.map +1 -0
- package/dist/UnauthorizedError.d.ts +10 -0
- package/dist/UnauthorizedError.d.ts.map +1 -0
- package/dist/UnauthorizedError.js +12 -0
- package/dist/UnauthorizedError.js.map +1 -0
- package/dist/UnsupportedMediaTypeError.d.ts +9 -0
- package/dist/UnsupportedMediaTypeError.d.ts.map +1 -0
- package/dist/UnsupportedMediaTypeError.js +11 -0
- package/dist/UnsupportedMediaTypeError.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -3
- package/README.md +0 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ServiceError } from './ServiceError';
|
|
2
|
+
import type { ServiceErrorOptions } from './ServiceError';
|
|
3
|
+
/**
|
|
4
|
+
* An error whose retryability is decided by the thrower, not deduced.
|
|
5
|
+
*
|
|
6
|
+
* Durable-DAV's `D1ErrorClassifier` can classify a raw D1 message, but a
|
|
7
|
+
* provider-level failure (OAuth2 grant revoked, upstream API rejecting a
|
|
8
|
+
* payload) carries no such signal — only the code that made the call knows.
|
|
9
|
+
* This taxonomy lets that code say so explicitly, and the status defaults
|
|
10
|
+
* follow the retry flag rather than a name-lookup table that could disagree.
|
|
11
|
+
*/
|
|
12
|
+
declare class OutcomeError extends ServiceError {
|
|
13
|
+
constructor(message: string, options: ServiceErrorOptions & {
|
|
14
|
+
retryable: boolean;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Transient upstream failure: a later attempt may succeed (throttling, 5xx
|
|
19
|
+
* from the provider, token refresh race). Status 502 by default.
|
|
20
|
+
*/
|
|
21
|
+
declare class RetryableError extends OutcomeError {
|
|
22
|
+
constructor(message: string, status?: number);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Permanent failure: retrying repeats the failure forever. A revoked grant
|
|
26
|
+
* retried every ten minutes told the caller the request was a server fault;
|
|
27
|
+
* this class exists so that never reads as retryable again. Status 400.
|
|
28
|
+
*/
|
|
29
|
+
declare class NonRetryableError extends OutcomeError {
|
|
30
|
+
constructor(message: string, status?: number);
|
|
31
|
+
}
|
|
32
|
+
declare class ProviderApiRetryableError extends RetryableError {
|
|
33
|
+
}
|
|
34
|
+
declare class ProviderApiNonRetryableError extends NonRetryableError {
|
|
35
|
+
}
|
|
36
|
+
declare class OAuth2TokenRetryableError extends RetryableError {
|
|
37
|
+
}
|
|
38
|
+
declare class OAuth2TokenNonRetryableError extends NonRetryableError {
|
|
39
|
+
}
|
|
40
|
+
export { NonRetryableError, OAuth2TokenNonRetryableError, OAuth2TokenRetryableError, OutcomeError, ProviderApiNonRetryableError, ProviderApiRetryableError, RetryableError, };
|
|
41
|
+
//# sourceMappingURL=OutcomeError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutcomeError.d.ts","sourceRoot":"","sources":["../src/OutcomeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;;;;;GAQG;AACH,cAAM,YAAa,SAAQ,YAAY;gBACzB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE;CAGnF;AAED;;;GAGG;AACH,cAAM,cAAe,SAAQ,YAAY;gBAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAM7C;AAED;;;;GAIG;AACH,cAAM,iBAAkB,SAAQ,YAAY;gBAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAM7C;AAED,cAAM,yBAA0B,SAAQ,cAAc;CAAG;AACzD,cAAM,4BAA6B,SAAQ,iBAAiB;CAAG;AAC/D,cAAM,yBAA0B,SAAQ,cAAc;CAAG;AACzD,cAAM,4BAA6B,SAAQ,iBAAiB;CAAG;AAE/D,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,YAAY,EACZ,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,GACf,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ServiceError } from './ServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* An error whose retryability is decided by the thrower, not deduced.
|
|
4
|
+
*
|
|
5
|
+
* Durable-DAV's `D1ErrorClassifier` can classify a raw D1 message, but a
|
|
6
|
+
* provider-level failure (OAuth2 grant revoked, upstream API rejecting a
|
|
7
|
+
* payload) carries no such signal — only the code that made the call knows.
|
|
8
|
+
* This taxonomy lets that code say so explicitly, and the status defaults
|
|
9
|
+
* follow the retry flag rather than a name-lookup table that could disagree.
|
|
10
|
+
*/
|
|
11
|
+
class OutcomeError extends ServiceError {
|
|
12
|
+
constructor(message, options) {
|
|
13
|
+
super(options.retryable ? 502 : 400, new.target.name, message, options);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Transient upstream failure: a later attempt may succeed (throttling, 5xx
|
|
18
|
+
* from the provider, token refresh race). Status 502 by default.
|
|
19
|
+
*/
|
|
20
|
+
class RetryableError extends OutcomeError {
|
|
21
|
+
constructor(message, status) {
|
|
22
|
+
super(message, { retryable: true, ...(status === undefined ? {} : { expose: status < 500 }) });
|
|
23
|
+
if (status !== undefined) {
|
|
24
|
+
this.status = status;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Permanent failure: retrying repeats the failure forever. A revoked grant
|
|
30
|
+
* retried every ten minutes told the caller the request was a server fault;
|
|
31
|
+
* this class exists so that never reads as retryable again. Status 400.
|
|
32
|
+
*/
|
|
33
|
+
class NonRetryableError extends OutcomeError {
|
|
34
|
+
constructor(message, status) {
|
|
35
|
+
super(message, { retryable: false, ...(status === undefined ? {} : { expose: status < 500 }) });
|
|
36
|
+
if (status !== undefined) {
|
|
37
|
+
this.status = status;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class ProviderApiRetryableError extends RetryableError {
|
|
42
|
+
}
|
|
43
|
+
class ProviderApiNonRetryableError extends NonRetryableError {
|
|
44
|
+
}
|
|
45
|
+
class OAuth2TokenRetryableError extends RetryableError {
|
|
46
|
+
}
|
|
47
|
+
class OAuth2TokenNonRetryableError extends NonRetryableError {
|
|
48
|
+
}
|
|
49
|
+
export { NonRetryableError, OAuth2TokenNonRetryableError, OAuth2TokenRetryableError, OutcomeError, ProviderApiNonRetryableError, ProviderApiRetryableError, RetryableError, };
|
|
50
|
+
//# sourceMappingURL=OutcomeError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutcomeError.js","sourceRoot":"","sources":["../src/OutcomeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;;;;;GAQG;AACH,MAAM,YAAa,SAAQ,YAAY;IACrC,YAAY,OAAe,EAAE,OAAqD;QAChF,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,cAAe,SAAQ,YAAY;IACvC,YAAY,OAAe,EAAE,MAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC/F,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,iBAAkB,SAAQ,YAAY;IAC1C,YAAY,OAAe,EAAE,MAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAChG,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AAED,MAAM,yBAA0B,SAAQ,cAAc;CAAG;AACzD,MAAM,4BAA6B,SAAQ,iBAAiB;CAAG;AAC/D,MAAM,yBAA0B,SAAQ,cAAc;CAAG;AACzD,MAAM,4BAA6B,SAAQ,iBAAiB;CAAG;AAE/D,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,YAAY,EACZ,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,GACf,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 413 — the payload exceeds the server's limits (request body, file, batch).
|
|
4
|
+
*/
|
|
5
|
+
declare class PayloadTooLargeError extends HttpServiceError<'payloadTooLarge'> {
|
|
6
|
+
constructor(message?: string);
|
|
7
|
+
}
|
|
8
|
+
export { PayloadTooLargeError };
|
|
9
|
+
//# sourceMappingURL=PayloadTooLargeError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadTooLargeError.d.ts","sourceRoot":"","sources":["../src/PayloadTooLargeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,cAAM,oBAAqB,SAAQ,gBAAgB,CAAC,iBAAiB,CAAC;gBACxD,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 413 — the payload exceeds the server's limits (request body, file, batch).
|
|
4
|
+
*/
|
|
5
|
+
class PayloadTooLargeError extends HttpServiceError {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super('payloadTooLarge', message);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export { PayloadTooLargeError };
|
|
11
|
+
//# sourceMappingURL=PayloadTooLargeError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadTooLargeError.js","sourceRoot":"","sources":["../src/PayloadTooLargeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,oBAAqB,SAAQ,gBAAmC;IACpE,YAAY,OAAgB;QAC1B,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;CACF;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 412 — a precondition the caller supplied (e.g. `If-Match`, expected state)
|
|
4
|
+
* did not hold. Retrying unmodified fails by definition.
|
|
5
|
+
*/
|
|
6
|
+
declare class PreconditionFailedError extends HttpServiceError<'preconditionFailed'> {
|
|
7
|
+
constructor(message?: string);
|
|
8
|
+
}
|
|
9
|
+
export { PreconditionFailedError };
|
|
10
|
+
//# sourceMappingURL=PreconditionFailedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreconditionFailedError.d.ts","sourceRoot":"","sources":["../src/PreconditionFailedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,cAAM,uBAAwB,SAAQ,gBAAgB,CAAC,oBAAoB,CAAC;gBAC9D,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 412 — a precondition the caller supplied (e.g. `If-Match`, expected state)
|
|
4
|
+
* did not hold. Retrying unmodified fails by definition.
|
|
5
|
+
*/
|
|
6
|
+
class PreconditionFailedError extends HttpServiceError {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super('preconditionFailed', message);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export { PreconditionFailedError };
|
|
12
|
+
//# sourceMappingURL=PreconditionFailedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreconditionFailedError.js","sourceRoot":"","sources":["../src/PreconditionFailedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,uBAAwB,SAAQ,gBAAsC;IAC1E,YAAY,OAAgB;QAC1B,KAAK,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 429 — the caller exceeded its rate budget. Retrying is not just futile but
|
|
4
|
+
* punished; honor `retryAfter`-style backoff at the caller.
|
|
5
|
+
*/
|
|
6
|
+
declare class RateLimitedError extends HttpServiceError<'rateLimited'> {
|
|
7
|
+
constructor(message?: string);
|
|
8
|
+
}
|
|
9
|
+
export { RateLimitedError };
|
|
10
|
+
//# sourceMappingURL=RateLimitedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimitedError.d.ts","sourceRoot":"","sources":["../src/RateLimitedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,cAAM,gBAAiB,SAAQ,gBAAgB,CAAC,aAAa,CAAC;gBAChD,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 429 — the caller exceeded its rate budget. Retrying is not just futile but
|
|
4
|
+
* punished; honor `retryAfter`-style backoff at the caller.
|
|
5
|
+
*/
|
|
6
|
+
class RateLimitedError extends HttpServiceError {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super('rateLimited', message);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export { RateLimitedError };
|
|
12
|
+
//# sourceMappingURL=RateLimitedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimitedError.js","sourceRoot":"","sources":["../src/RateLimitedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,gBAAiB,SAAQ,gBAA+B;IAC5D,YAAY,OAAgB;QAC1B,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;CACF;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ErrorResponse } from './ErrorResponse';
|
|
2
|
+
interface ServiceErrorOptions {
|
|
3
|
+
/** Marks a transient failure: a caller retrying is meaningful. */
|
|
4
|
+
retryable?: boolean;
|
|
5
|
+
/** Whether the raw message may reach a client. Defaults to `status < 500`. */
|
|
6
|
+
expose?: boolean;
|
|
7
|
+
/** Underlying cause, preserved for operator-facing logs. */
|
|
8
|
+
cause?: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface ErrorHttpPayload {
|
|
11
|
+
status: number;
|
|
12
|
+
body: ErrorResponse;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Root of the error taxonomy.
|
|
16
|
+
*
|
|
17
|
+
* Every boundary in the family (route handlers, middleware, background tasks)
|
|
18
|
+
* branches on `instanceof ServiceError`, so every concrete error must genuinely
|
|
19
|
+
* extend it — an `implements` leaves the prototype chain broken and silently
|
|
20
|
+
* masks typed errors as generic 500s.
|
|
21
|
+
*
|
|
22
|
+
* Status/type/retryable/expose are public fields, not methods: the values are
|
|
23
|
+
* fixed at construction, and callers in all nine repos read them far more often
|
|
24
|
+
* than they were ever written.
|
|
25
|
+
*/
|
|
26
|
+
declare abstract class ServiceError extends Error {
|
|
27
|
+
/** The HTTP status. Defaults from the catalog; a subclass may refine it. */
|
|
28
|
+
status: number;
|
|
29
|
+
/** Overridable by subclasses whose identity differs from the HTTP class name. */
|
|
30
|
+
type: string;
|
|
31
|
+
/** False by default: retrying is the exception, not the rule. */
|
|
32
|
+
retryable: boolean;
|
|
33
|
+
/** Whether the raw message may reach a client. Defaults to `status < 500`. */
|
|
34
|
+
expose: boolean;
|
|
35
|
+
constructor(status: number, type: string, message: string, options?: ServiceErrorOptions);
|
|
36
|
+
/**
|
|
37
|
+
* The wire form: status plus the family's `ErrorResponse` envelope.
|
|
38
|
+
*
|
|
39
|
+
* A non-exposing error (5xx) has its message substituted — `message` is for
|
|
40
|
+
* operators, and pushing it to clients leaks internals. The substitution
|
|
41
|
+
* lives here, once, rather than in nine boundary mappers.
|
|
42
|
+
*/
|
|
43
|
+
toErrorResponse(): ErrorHttpPayload;
|
|
44
|
+
/**
|
|
45
|
+
* Normalize an unknown catch-block value into the taxonomy.
|
|
46
|
+
*
|
|
47
|
+
* A `ServiceError` passes through untouched (re-wrapping would bury its
|
|
48
|
+
* context); anything else becomes a non-retryable 500 carrying the original
|
|
49
|
+
* message and cause. Boundary code should call this before mapping an error
|
|
50
|
+
* to a response, so `error instanceof ServiceError` is guaranteed downstream.
|
|
51
|
+
*/
|
|
52
|
+
static from(error: unknown): ServiceError;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Private throwable used by `ServiceError.from` for pass-through wrapping.
|
|
56
|
+
* Not exported: reach `InternalServerError` for the public 500.
|
|
57
|
+
*/
|
|
58
|
+
declare class InternalServiceError extends ServiceError {
|
|
59
|
+
constructor(message: string, options?: ServiceErrorOptions);
|
|
60
|
+
}
|
|
61
|
+
export { ServiceError, InternalServiceError };
|
|
62
|
+
export type { ServiceErrorOptions, ErrorHttpPayload };
|
|
63
|
+
//# sourceMappingURL=ServiceError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceError.d.ts","sourceRoot":"","sources":["../src/ServiceError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,mBAAmB;IAC3B,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;CACrB;AAID;;;;;;;;;;;GAWG;AACH,uBAAe,YAAa,SAAQ,KAAK;IACvC,4EAA4E;IACrE,MAAM,EAAE,MAAM,CAAC;IAEtB,iFAAiF;IAC1E,IAAI,EAAE,MAAM,CAAC;IAEpB,iEAAiE;IAC1D,SAAS,EAAE,OAAO,CAAC;IAE1B,8EAA8E;IACvE,MAAM,EAAE,OAAO,CAAC;gBAEX,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;IAexF;;;;;;OAMG;IACI,eAAe,IAAI,gBAAgB;IAa1C;;;;;;;OAOG;WACW,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY;CASjD;AAED;;;GAGG;AACH,cAAM,oBAAqB,SAAQ,YAAY;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;CAG3D;AAED,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const INTERNAL_SERVER_MESSAGE = 'The server encountered an internal error and was unable to complete your request.';
|
|
2
|
+
/**
|
|
3
|
+
* Root of the error taxonomy.
|
|
4
|
+
*
|
|
5
|
+
* Every boundary in the family (route handlers, middleware, background tasks)
|
|
6
|
+
* branches on `instanceof ServiceError`, so every concrete error must genuinely
|
|
7
|
+
* extend it — an `implements` leaves the prototype chain broken and silently
|
|
8
|
+
* masks typed errors as generic 500s.
|
|
9
|
+
*
|
|
10
|
+
* Status/type/retryable/expose are public fields, not methods: the values are
|
|
11
|
+
* fixed at construction, and callers in all nine repos read them far more often
|
|
12
|
+
* than they were ever written.
|
|
13
|
+
*/
|
|
14
|
+
class ServiceError extends Error {
|
|
15
|
+
/** The HTTP status. Defaults from the catalog; a subclass may refine it. */
|
|
16
|
+
status;
|
|
17
|
+
/** Overridable by subclasses whose identity differs from the HTTP class name. */
|
|
18
|
+
type;
|
|
19
|
+
/** False by default: retrying is the exception, not the rule. */
|
|
20
|
+
retryable;
|
|
21
|
+
/** Whether the raw message may reach a client. Defaults to `status < 500`. */
|
|
22
|
+
expose;
|
|
23
|
+
constructor(status, type, message, options) {
|
|
24
|
+
super(message);
|
|
25
|
+
// `new.target.name` rather than the passed type: a subclass reports itself
|
|
26
|
+
// even if its author forgot to name it, so log lines and client payloads
|
|
27
|
+
// never disagree about what failed.
|
|
28
|
+
this.name = new.target.name;
|
|
29
|
+
this.status = status;
|
|
30
|
+
this.type = type;
|
|
31
|
+
this.retryable = options?.retryable ?? false;
|
|
32
|
+
this.expose = options?.expose ?? status < 500;
|
|
33
|
+
if (options?.cause !== undefined) {
|
|
34
|
+
this.cause = options.cause;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The wire form: status plus the family's `ErrorResponse` envelope.
|
|
39
|
+
*
|
|
40
|
+
* A non-exposing error (5xx) has its message substituted — `message` is for
|
|
41
|
+
* operators, and pushing it to clients leaks internals. The substitution
|
|
42
|
+
* lives here, once, rather than in nine boundary mappers.
|
|
43
|
+
*/
|
|
44
|
+
toErrorResponse() {
|
|
45
|
+
const message = this.expose ? this.message : INTERNAL_SERVER_MESSAGE;
|
|
46
|
+
return {
|
|
47
|
+
status: this.status,
|
|
48
|
+
body: {
|
|
49
|
+
Exception: {
|
|
50
|
+
Type: this.type,
|
|
51
|
+
Message: message,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Normalize an unknown catch-block value into the taxonomy.
|
|
58
|
+
*
|
|
59
|
+
* A `ServiceError` passes through untouched (re-wrapping would bury its
|
|
60
|
+
* context); anything else becomes a non-retryable 500 carrying the original
|
|
61
|
+
* message and cause. Boundary code should call this before mapping an error
|
|
62
|
+
* to a response, so `error instanceof ServiceError` is guaranteed downstream.
|
|
63
|
+
*/
|
|
64
|
+
static from(error) {
|
|
65
|
+
if (error instanceof ServiceError) {
|
|
66
|
+
return error;
|
|
67
|
+
}
|
|
68
|
+
if (error instanceof Error) {
|
|
69
|
+
return new InternalServiceError(error.message, { cause: error });
|
|
70
|
+
}
|
|
71
|
+
return new InternalServiceError(String(error), { cause: error });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Private throwable used by `ServiceError.from` for pass-through wrapping.
|
|
76
|
+
* Not exported: reach `InternalServerError` for the public 500.
|
|
77
|
+
*/
|
|
78
|
+
class InternalServiceError extends ServiceError {
|
|
79
|
+
constructor(message, options) {
|
|
80
|
+
super(500, 'InternalError', message, options);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export { ServiceError, InternalServiceError };
|
|
84
|
+
//# sourceMappingURL=ServiceError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceError.js","sourceRoot":"","sources":["../src/ServiceError.ts"],"names":[],"mappings":"AAgBA,MAAM,uBAAuB,GAAG,mFAAmF,CAAC;AAEpH;;;;;;;;;;;GAWG;AACH,MAAe,YAAa,SAAQ,KAAK;IACvC,4EAA4E;IACrE,MAAM,CAAS;IAEtB,iFAAiF;IAC1E,IAAI,CAAS;IAEpB,iEAAiE;IAC1D,SAAS,CAAU;IAE1B,8EAA8E;IACvE,MAAM,CAAU;IAEvB,YAAY,MAAc,EAAE,IAAY,EAAE,OAAe,EAAE,OAA6B;QACtF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,2EAA2E;QAC3E,yEAAyE;QACzE,oCAAoC;QACpC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,KAAK,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,MAAM,GAAG,GAAG,CAAC;QAC9C,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC7B,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,MAAM,OAAO,GAAW,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC;QAC7E,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE;gBACJ,SAAS,EAAE;oBACT,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,OAAO,EAAE,OAAO;iBACjB;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,IAAI,CAAC,KAAc;QAC/B,IAAI,KAAK,YAAY,YAAY,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,IAAI,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,IAAI,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,oBAAqB,SAAQ,YAAY;IAC7C,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF;AAED,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 503 — unavailable now, healthy later. The natural status for retryable
|
|
4
|
+
* infrastructure failures (a locked D1, an overloaded upstream).
|
|
5
|
+
*/
|
|
6
|
+
declare class ServiceUnavailableError extends HttpServiceError<'serviceUnavailable'> {
|
|
7
|
+
constructor(message?: string);
|
|
8
|
+
}
|
|
9
|
+
export { ServiceUnavailableError };
|
|
10
|
+
//# sourceMappingURL=ServiceUnavailableError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceUnavailableError.d.ts","sourceRoot":"","sources":["../src/ServiceUnavailableError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,cAAM,uBAAwB,SAAQ,gBAAgB,CAAC,oBAAoB,CAAC;gBAC9D,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 503 — unavailable now, healthy later. The natural status for retryable
|
|
4
|
+
* infrastructure failures (a locked D1, an overloaded upstream).
|
|
5
|
+
*/
|
|
6
|
+
class ServiceUnavailableError extends HttpServiceError {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super('serviceUnavailable', message);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export { ServiceUnavailableError };
|
|
12
|
+
//# sourceMappingURL=ServiceUnavailableError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceUnavailableError.js","sourceRoot":"","sources":["../src/ServiceUnavailableError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,uBAAwB,SAAQ,gBAAsC;IAC1E,YAAY,OAAgB;QAC1B,KAAK,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 401 — credentials missing, expired, or rejected. Distinct from `Forbidden`:
|
|
4
|
+
* re-authenticating may help; `Forbidden` it will not.
|
|
5
|
+
*/
|
|
6
|
+
declare class UnauthorizedError extends HttpServiceError<'unauthorized'> {
|
|
7
|
+
constructor(message?: string);
|
|
8
|
+
}
|
|
9
|
+
export { UnauthorizedError };
|
|
10
|
+
//# sourceMappingURL=UnauthorizedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnauthorizedError.d.ts","sourceRoot":"","sources":["../src/UnauthorizedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,cAAM,iBAAkB,SAAQ,gBAAgB,CAAC,cAAc,CAAC;gBAClD,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 401 — credentials missing, expired, or rejected. Distinct from `Forbidden`:
|
|
4
|
+
* re-authenticating may help; `Forbidden` it will not.
|
|
5
|
+
*/
|
|
6
|
+
class UnauthorizedError extends HttpServiceError {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super('unauthorized', message);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export { UnauthorizedError };
|
|
12
|
+
//# sourceMappingURL=UnauthorizedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnauthorizedError.js","sourceRoot":"","sources":["../src/UnauthorizedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,iBAAkB,SAAQ,gBAAgC;IAC9D,YAAY,OAAgB;QAC1B,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;CACF;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 415 — the body's content type is not one the endpoint can parse.
|
|
4
|
+
*/
|
|
5
|
+
declare class UnsupportedMediaTypeError extends HttpServiceError<'unsupportedMediaType'> {
|
|
6
|
+
constructor(message?: string);
|
|
7
|
+
}
|
|
8
|
+
export { UnsupportedMediaTypeError };
|
|
9
|
+
//# sourceMappingURL=UnsupportedMediaTypeError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsupportedMediaTypeError.d.ts","sourceRoot":"","sources":["../src/UnsupportedMediaTypeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,cAAM,yBAA0B,SAAQ,gBAAgB,CAAC,sBAAsB,CAAC;gBAClE,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpServiceError } from './HttpServiceError';
|
|
2
|
+
/**
|
|
3
|
+
* 415 — the body's content type is not one the endpoint can parse.
|
|
4
|
+
*/
|
|
5
|
+
class UnsupportedMediaTypeError extends HttpServiceError {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super('unsupportedMediaType', message);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export { UnsupportedMediaTypeError };
|
|
11
|
+
//# sourceMappingURL=UnsupportedMediaTypeError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsupportedMediaTypeError.js","sourceRoot":"","sources":["../src/UnsupportedMediaTypeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,yBAA0B,SAAQ,gBAAwC;IAC9E,YAAY,OAAgB;QAC1B,KAAK,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;CACF;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { CATALOG } from './CATALOG';
|
|
2
|
+
export type { HttpErrorDefinition, HttpErrorType } from './CATALOG';
|
|
3
|
+
export { ServiceError } from './ServiceError';
|
|
4
|
+
export type { ServiceErrorOptions, ErrorHttpPayload } from './ServiceError';
|
|
5
|
+
export { HttpServiceError } from './HttpServiceError';
|
|
6
|
+
export { BadRequestError } from './BadRequestError';
|
|
7
|
+
export { UnauthorizedError } from './UnauthorizedError';
|
|
8
|
+
export { ForbiddenError } from './ForbiddenError';
|
|
9
|
+
export { NotFoundError } from './NotFoundError';
|
|
10
|
+
export { MethodNotAllowedError } from './MethodNotAllowedError';
|
|
11
|
+
export { ConflictError } from './ConflictError';
|
|
12
|
+
export { PreconditionFailedError } from './PreconditionFailedError';
|
|
13
|
+
export { PayloadTooLargeError } from './PayloadTooLargeError';
|
|
14
|
+
export { UnsupportedMediaTypeError } from './UnsupportedMediaTypeError';
|
|
15
|
+
export { RateLimitedError } from './RateLimitedError';
|
|
16
|
+
export { InternalServerError, DefaultInternalServerError } from './InternalServerError';
|
|
17
|
+
export { NotImplementedError } from './NotImplementedError';
|
|
18
|
+
export { BadGatewayError } from './BadGatewayError';
|
|
19
|
+
export { ServiceUnavailableError } from './ServiceUnavailableError';
|
|
20
|
+
export { DatabaseError } from './DatabaseError';
|
|
21
|
+
export { NonRetryableError, OAuth2TokenNonRetryableError, OAuth2TokenRetryableError, OutcomeError, ProviderApiNonRetryableError, ProviderApiRetryableError, RetryableError, } from './OutcomeError';
|
|
22
|
+
export type { ErrorResponse } from './ErrorResponse';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,YAAY,EACZ,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { CATALOG } from './CATALOG';
|
|
2
|
+
export { ServiceError } from './ServiceError';
|
|
3
|
+
export { HttpServiceError } from './HttpServiceError';
|
|
4
|
+
export { BadRequestError } from './BadRequestError';
|
|
5
|
+
export { UnauthorizedError } from './UnauthorizedError';
|
|
6
|
+
export { ForbiddenError } from './ForbiddenError';
|
|
7
|
+
export { NotFoundError } from './NotFoundError';
|
|
8
|
+
export { MethodNotAllowedError } from './MethodNotAllowedError';
|
|
9
|
+
export { ConflictError } from './ConflictError';
|
|
10
|
+
export { PreconditionFailedError } from './PreconditionFailedError';
|
|
11
|
+
export { PayloadTooLargeError } from './PayloadTooLargeError';
|
|
12
|
+
export { UnsupportedMediaTypeError } from './UnsupportedMediaTypeError';
|
|
13
|
+
export { RateLimitedError } from './RateLimitedError';
|
|
14
|
+
export { InternalServerError, DefaultInternalServerError } from './InternalServerError';
|
|
15
|
+
export { NotImplementedError } from './NotImplementedError';
|
|
16
|
+
export { BadGatewayError } from './BadGatewayError';
|
|
17
|
+
export { ServiceUnavailableError } from './ServiceUnavailableError';
|
|
18
|
+
export { DatabaseError } from './DatabaseError';
|
|
19
|
+
export { NonRetryableError, OAuth2TokenNonRetryableError, OAuth2TokenRetryableError, OutcomeError, ProviderApiNonRetryableError, ProviderApiRetryableError, RetryableError, } from './OutcomeError';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,YAAY,EACZ,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexezuge/errors",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Rexezuge-CloudflareWorkers/SDK.git",
|
|
9
|
+
"directory": "packages/errors"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./*": {
|
|
20
|
+
"types": "./dist/*.d.ts",
|
|
21
|
+
"default": "./dist/*.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "26.6.4",
|
|
29
|
+
"typescript": "6.0.3",
|
|
30
|
+
"vitest": "4.1.11"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc -p tsconfig.json",
|
|
34
|
+
"typecheck": "tsc -p tsconfig.test.json --noEmit",
|
|
35
|
+
"test": "vitest run"
|
|
36
|
+
}
|
|
6
37
|
}
|
package/README.md
DELETED