@rexezuge/errors 1.3.0 → 1.5.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/BadGatewayError.js +1 -12
- package/dist/BadGatewayError.js.map +7 -1
- package/dist/BadRequestError.js +1 -11
- package/dist/BadRequestError.js.map +7 -1
- package/dist/CATALOG.js +1 -92
- package/dist/CATALOG.js.map +7 -1
- package/dist/ConflictError.js +1 -12
- package/dist/ConflictError.js.map +7 -1
- package/dist/DatabaseError.js +1 -18
- package/dist/DatabaseError.js.map +7 -1
- package/dist/ErrorResponse.js +0 -2
- package/dist/ErrorResponse.js.map +7 -1
- package/dist/ForbiddenError.js +1 -11
- package/dist/ForbiddenError.js.map +7 -1
- package/dist/HttpServiceError.js +1 -16
- package/dist/HttpServiceError.js.map +7 -1
- package/dist/InternalServerError.js +1 -16
- package/dist/InternalServerError.js.map +7 -1
- package/dist/MethodNotAllowedError.js +1 -11
- package/dist/MethodNotAllowedError.js.map +7 -1
- package/dist/NotFoundError.js +1 -11
- package/dist/NotFoundError.js.map +7 -1
- package/dist/NotImplementedError.js +1 -11
- package/dist/NotImplementedError.js.map +7 -1
- package/dist/OutcomeError.js +1 -50
- package/dist/OutcomeError.js.map +7 -1
- package/dist/PayloadTooLargeError.js +1 -11
- package/dist/PayloadTooLargeError.js.map +7 -1
- package/dist/PreconditionFailedError.js +1 -12
- package/dist/PreconditionFailedError.js.map +7 -1
- package/dist/RateLimitedError.js +1 -12
- package/dist/RateLimitedError.js.map +7 -1
- package/dist/ServiceError.d.ts +21 -7
- package/dist/ServiceError.d.ts.map +1 -1
- package/dist/ServiceError.js +1 -84
- package/dist/ServiceError.js.map +7 -1
- package/dist/ServiceUnavailableError.js +1 -12
- package/dist/ServiceUnavailableError.js.map +7 -1
- package/dist/SubrequestBudgetExhaustedError.d.ts +22 -0
- package/dist/SubrequestBudgetExhaustedError.d.ts.map +1 -0
- package/dist/SubrequestBudgetExhaustedError.js +1 -0
- package/dist/SubrequestBudgetExhaustedError.js.map +7 -0
- package/dist/UnauthorizedError.js +1 -12
- package/dist/UnauthorizedError.js.map +7 -1
- package/dist/UnsupportedMediaTypeError.js +1 -11
- package/dist/UnsupportedMediaTypeError.js.map +7 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -20
- package/dist/index.js.map +7 -1
- package/package.json +2 -2
package/dist/BadGatewayError.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 502 — an upstream dependency answered invalidly. Pair with `retryable: true`
|
|
4
|
-
* when the upstream is known to recover on its own.
|
|
5
|
-
*/
|
|
6
|
-
class BadGatewayError extends HttpServiceError {
|
|
7
|
-
constructor(message) {
|
|
8
|
-
super('BadGateway', message);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export { BadGatewayError };
|
|
12
|
-
//# sourceMappingURL=BadGatewayError.js.map
|
|
1
|
+
import{HttpServiceError as t}from"./HttpServiceError.js";class e extends t{constructor(r){super("BadGateway",r)}}export{e as BadGatewayError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/BadGatewayError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 502 — an upstream dependency answered invalidly. Pair with `retryable: true`\n * when the upstream is known to recover on its own.\n */\nclass BadGatewayError extends HttpServiceError<'BadGateway'> {\n constructor(message?: string) {\n super('BadGateway', message);\n }\n}\n\nexport { BadGatewayError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAMjC,MAAMC,UAAwBD,CAA8B,CAC1D,YAAYE,EAAgB,CAC1B,MAAM,aAAcA,CAAO,CAC7B",
|
|
6
|
+
"names": ["HttpServiceError", "BadGatewayError", "message"]
|
|
7
|
+
}
|
package/dist/BadRequestError.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 400 — malformed or missing input. Retrying without a change always fails.
|
|
4
|
-
*/
|
|
5
|
-
class BadRequestError extends HttpServiceError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super('BadRequest', message);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export { BadRequestError };
|
|
11
|
-
//# sourceMappingURL=BadRequestError.js.map
|
|
1
|
+
import{HttpServiceError as e}from"./HttpServiceError.js";class t extends e{constructor(r){super("BadRequest",r)}}export{t as BadRequestError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/BadRequestError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 400 — malformed or missing input. Retrying without a change always fails.\n */\nclass BadRequestError extends HttpServiceError<'BadRequest'> {\n constructor(message?: string) {\n super('BadRequest', message);\n }\n}\n\nexport { BadRequestError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAKjC,MAAMC,UAAwBD,CAA8B,CAC1D,YAAYE,EAAgB,CAC1B,MAAM,aAAcA,CAAO,CAC7B",
|
|
6
|
+
"names": ["HttpServiceError", "BadRequestError", "message"]
|
|
7
|
+
}
|
package/dist/CATALOG.js
CHANGED
|
@@ -1,92 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
BadRequest: {
|
|
3
|
-
status: 400,
|
|
4
|
-
code: 'BAD_REQUEST',
|
|
5
|
-
defaultMessage: 'The request could not be understood or was missing required parameters.',
|
|
6
|
-
expose: true,
|
|
7
|
-
},
|
|
8
|
-
Unauthorized: {
|
|
9
|
-
status: 401,
|
|
10
|
-
code: 'UNAUTHORIZED',
|
|
11
|
-
defaultMessage: 'Authentication is required and has failed or has not yet been provided.',
|
|
12
|
-
expose: true,
|
|
13
|
-
},
|
|
14
|
-
Forbidden: {
|
|
15
|
-
status: 403,
|
|
16
|
-
code: 'FORBIDDEN',
|
|
17
|
-
defaultMessage: 'You do not have permission to perform this action.',
|
|
18
|
-
expose: true,
|
|
19
|
-
},
|
|
20
|
-
NotFound: {
|
|
21
|
-
status: 404,
|
|
22
|
-
code: 'NOT_FOUND',
|
|
23
|
-
defaultMessage: 'The requested resource was not found.',
|
|
24
|
-
expose: true,
|
|
25
|
-
},
|
|
26
|
-
MethodNotAllowed: {
|
|
27
|
-
status: 405,
|
|
28
|
-
code: 'METHOD_NOT_ALLOWED',
|
|
29
|
-
defaultMessage: 'The requested method is not allowed for this resource.',
|
|
30
|
-
expose: true,
|
|
31
|
-
},
|
|
32
|
-
Conflict: {
|
|
33
|
-
// Distinct from `BadRequest` so callers can tell "invalid input" from
|
|
34
|
-
// "that value is taken" — the latter never succeeds without a change.
|
|
35
|
-
status: 409,
|
|
36
|
-
code: 'CONFLICT',
|
|
37
|
-
defaultMessage: 'The request conflicts with the current state of the resource.',
|
|
38
|
-
expose: true,
|
|
39
|
-
},
|
|
40
|
-
PreconditionFailed: {
|
|
41
|
-
status: 412,
|
|
42
|
-
code: 'PRECONDITION_FAILED',
|
|
43
|
-
defaultMessage: 'A precondition for this request failed.',
|
|
44
|
-
expose: true,
|
|
45
|
-
},
|
|
46
|
-
PayloadTooLarge: {
|
|
47
|
-
status: 413,
|
|
48
|
-
code: 'PAYLOAD_TOO_LARGE',
|
|
49
|
-
defaultMessage: 'The request payload is larger than the server is willing to process.',
|
|
50
|
-
expose: true,
|
|
51
|
-
},
|
|
52
|
-
UnsupportedMediaType: {
|
|
53
|
-
status: 415,
|
|
54
|
-
code: 'UNSUPPORTED_MEDIA_TYPE',
|
|
55
|
-
defaultMessage: 'The request payload format is not supported by this resource.',
|
|
56
|
-
expose: true,
|
|
57
|
-
},
|
|
58
|
-
RateLimited: {
|
|
59
|
-
status: 429,
|
|
60
|
-
code: 'RATE_LIMITED',
|
|
61
|
-
defaultMessage: 'Too many requests — slow down and retry later.',
|
|
62
|
-
expose: true,
|
|
63
|
-
},
|
|
64
|
-
InternalServerError: {
|
|
65
|
-
status: 500,
|
|
66
|
-
code: 'INTERNAL_SERVER_ERROR',
|
|
67
|
-
defaultMessage: 'The server encountered an internal error and was unable to complete your request.',
|
|
68
|
-
expose: false,
|
|
69
|
-
},
|
|
70
|
-
NotImplemented: {
|
|
71
|
-
status: 501,
|
|
72
|
-
code: 'NOT_IMPLEMENTED',
|
|
73
|
-
defaultMessage: 'The server does not support the functionality required to fulfil this request.',
|
|
74
|
-
expose: false,
|
|
75
|
-
},
|
|
76
|
-
// Upstream dependency failures: 502 is the honest status here, and the
|
|
77
|
-
// retryable marker (not the status) is what schedules a retry.
|
|
78
|
-
BadGateway: {
|
|
79
|
-
status: 502,
|
|
80
|
-
code: 'BAD_GATEWAY',
|
|
81
|
-
defaultMessage: 'The server received an invalid response from an upstream service.',
|
|
82
|
-
expose: false,
|
|
83
|
-
},
|
|
84
|
-
ServiceUnavailable: {
|
|
85
|
-
status: 503,
|
|
86
|
-
code: 'SERVICE_UNAVAILABLE',
|
|
87
|
-
defaultMessage: 'The server is currently unable to handle the request — retry after a delay.',
|
|
88
|
-
expose: true,
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
export { CATALOG };
|
|
92
|
-
//# sourceMappingURL=CATALOG.js.map
|
|
1
|
+
const e={BadRequest:{status:400,code:"BAD_REQUEST",defaultMessage:"The request could not be understood or was missing required parameters.",expose:!0},Unauthorized:{status:401,code:"UNAUTHORIZED",defaultMessage:"Authentication is required and has failed or has not yet been provided.",expose:!0},Forbidden:{status:403,code:"FORBIDDEN",defaultMessage:"You do not have permission to perform this action.",expose:!0},NotFound:{status:404,code:"NOT_FOUND",defaultMessage:"The requested resource was not found.",expose:!0},MethodNotAllowed:{status:405,code:"METHOD_NOT_ALLOWED",defaultMessage:"The requested method is not allowed for this resource.",expose:!0},Conflict:{status:409,code:"CONFLICT",defaultMessage:"The request conflicts with the current state of the resource.",expose:!0},PreconditionFailed:{status:412,code:"PRECONDITION_FAILED",defaultMessage:"A precondition for this request failed.",expose:!0},PayloadTooLarge:{status:413,code:"PAYLOAD_TOO_LARGE",defaultMessage:"The request payload is larger than the server is willing to process.",expose:!0},UnsupportedMediaType:{status:415,code:"UNSUPPORTED_MEDIA_TYPE",defaultMessage:"The request payload format is not supported by this resource.",expose:!0},RateLimited:{status:429,code:"RATE_LIMITED",defaultMessage:"Too many requests \u2014 slow down and retry later.",expose:!0},InternalServerError:{status:500,code:"INTERNAL_SERVER_ERROR",defaultMessage:"The server encountered an internal error and was unable to complete your request.",expose:!1},NotImplemented:{status:501,code:"NOT_IMPLEMENTED",defaultMessage:"The server does not support the functionality required to fulfil this request.",expose:!1},BadGateway:{status:502,code:"BAD_GATEWAY",defaultMessage:"The server received an invalid response from an upstream service.",expose:!1},ServiceUnavailable:{status:503,code:"SERVICE_UNAVAILABLE",defaultMessage:"The server is currently unable to handle the request \u2014 retry after a delay.",expose:!0}};export{e as CATALOG};
|
package/dist/CATALOG.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/CATALOG.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The single source of truth for HTTP-semantic errors.\n *\n * Eight repos carried this table as fourteen copy-pasted classes; the status,\n * machine code, and default message could drift per file. The catalog keeps all\n * three fields adjacent, so adding a status is one row, and a status can never\n * disagree with its code.\n *\n * `expose` marks whether the raw message may reach a client. Every 4xx is\n * trusted; every 5xx is not — a 5xx message is for operators, and\n * `toErrorResponse()` substitutes a generic one.\n */\ninterface HttpErrorDefinition {\n status: number;\n code: string;\n defaultMessage: string;\n expose: boolean;\n}\n\nconst CATALOG = {\n BadRequest: {\n status: 400,\n code: 'BAD_REQUEST',\n defaultMessage: 'The request could not be understood or was missing required parameters.',\n expose: true,\n },\n Unauthorized: {\n status: 401,\n code: 'UNAUTHORIZED',\n defaultMessage: 'Authentication is required and has failed or has not yet been provided.',\n expose: true,\n },\n Forbidden: {\n status: 403,\n code: 'FORBIDDEN',\n defaultMessage: 'You do not have permission to perform this action.',\n expose: true,\n },\n NotFound: {\n status: 404,\n code: 'NOT_FOUND',\n defaultMessage: 'The requested resource was not found.',\n expose: true,\n },\n MethodNotAllowed: {\n status: 405,\n code: 'METHOD_NOT_ALLOWED',\n defaultMessage: 'The requested method is not allowed for this resource.',\n expose: true,\n },\n Conflict: {\n // Distinct from `BadRequest` so callers can tell \"invalid input\" from\n // \"that value is taken\" — the latter never succeeds without a change.\n status: 409,\n code: 'CONFLICT',\n defaultMessage: 'The request conflicts with the current state of the resource.',\n expose: true,\n },\n PreconditionFailed: {\n status: 412,\n code: 'PRECONDITION_FAILED',\n defaultMessage: 'A precondition for this request failed.',\n expose: true,\n },\n PayloadTooLarge: {\n status: 413,\n code: 'PAYLOAD_TOO_LARGE',\n defaultMessage: 'The request payload is larger than the server is willing to process.',\n expose: true,\n },\n UnsupportedMediaType: {\n status: 415,\n code: 'UNSUPPORTED_MEDIA_TYPE',\n defaultMessage: 'The request payload format is not supported by this resource.',\n expose: true,\n },\n RateLimited: {\n status: 429,\n code: 'RATE_LIMITED',\n defaultMessage: 'Too many requests — slow down and retry later.',\n expose: true,\n },\n InternalServerError: {\n status: 500,\n code: 'INTERNAL_SERVER_ERROR',\n defaultMessage: 'The server encountered an internal error and was unable to complete your request.',\n expose: false,\n },\n NotImplemented: {\n status: 501,\n code: 'NOT_IMPLEMENTED',\n defaultMessage: 'The server does not support the functionality required to fulfil this request.',\n expose: false,\n },\n // Upstream dependency failures: 502 is the honest status here, and the\n // retryable marker (not the status) is what schedules a retry.\n BadGateway: {\n status: 502,\n code: 'BAD_GATEWAY',\n defaultMessage: 'The server received an invalid response from an upstream service.',\n expose: false,\n },\n ServiceUnavailable: {\n status: 503,\n code: 'SERVICE_UNAVAILABLE',\n defaultMessage: 'The server is currently unable to handle the request — retry after a delay.',\n expose: true,\n },\n} as const satisfies Record<string, HttpErrorDefinition>;\n\ntype HttpErrorType = keyof typeof CATALOG;\n\nexport { CATALOG };\nexport type { HttpErrorDefinition, HttpErrorType };\n"],
|
|
5
|
+
"mappings": "AAmBA,MAAMA,EAAU,CACd,WAAY,CACV,OAAQ,IACR,KAAM,cACN,eAAgB,0EAChB,OAAQ,IAEV,aAAc,CACZ,OAAQ,IACR,KAAM,eACN,eAAgB,0EAChB,OAAQ,IAEV,UAAW,CACT,OAAQ,IACR,KAAM,YACN,eAAgB,qDAChB,OAAQ,IAEV,SAAU,CACR,OAAQ,IACR,KAAM,YACN,eAAgB,wCAChB,OAAQ,IAEV,iBAAkB,CAChB,OAAQ,IACR,KAAM,qBACN,eAAgB,yDAChB,OAAQ,IAEV,SAAU,CAGR,OAAQ,IACR,KAAM,WACN,eAAgB,gEAChB,OAAQ,IAEV,mBAAoB,CAClB,OAAQ,IACR,KAAM,sBACN,eAAgB,0CAChB,OAAQ,IAEV,gBAAiB,CACf,OAAQ,IACR,KAAM,oBACN,eAAgB,uEAChB,OAAQ,IAEV,qBAAsB,CACpB,OAAQ,IACR,KAAM,yBACN,eAAgB,gEAChB,OAAQ,IAEV,YAAa,CACX,OAAQ,IACR,KAAM,eACN,eAAgB,sDAChB,OAAQ,IAEV,oBAAqB,CACnB,OAAQ,IACR,KAAM,wBACN,eAAgB,oFAChB,OAAQ,IAEV,eAAgB,CACd,OAAQ,IACR,KAAM,kBACN,eAAgB,iFAChB,OAAQ,IAIV,WAAY,CACV,OAAQ,IACR,KAAM,cACN,eAAgB,oEAChB,OAAQ,IAEV,mBAAoB,CAClB,OAAQ,IACR,KAAM,sBACN,eAAgB,mFAChB,OAAQ",
|
|
6
|
+
"names": ["CATALOG"]
|
|
7
|
+
}
|
package/dist/ConflictError.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 409 — well-formed but the resource state forbids it: a taken email, a
|
|
4
|
-
* duplicate name, a stale precondition. Not retryable without a change.
|
|
5
|
-
*/
|
|
6
|
-
class ConflictError extends HttpServiceError {
|
|
7
|
-
constructor(message) {
|
|
8
|
-
super('Conflict', message);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export { ConflictError };
|
|
12
|
-
//# sourceMappingURL=ConflictError.js.map
|
|
1
|
+
import{HttpServiceError as o}from"./HttpServiceError.js";class t extends o{constructor(r){super("Conflict",r)}}export{t as ConflictError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ConflictError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 409 — well-formed but the resource state forbids it: a taken email, a\n * duplicate name, a stale precondition. Not retryable without a change.\n */\nclass ConflictError extends HttpServiceError<'Conflict'> {\n constructor(message?: string) {\n super('Conflict', message);\n }\n}\n\nexport { ConflictError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAMjC,MAAMC,UAAsBD,CAA4B,CACtD,YAAYE,EAAgB,CAC1B,MAAM,WAAYA,CAAO,CAC3B",
|
|
6
|
+
"names": ["HttpServiceError", "ConflictError", "message"]
|
|
7
|
+
}
|
package/dist/DatabaseError.js
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 500 for data-layer failures.
|
|
4
|
-
*
|
|
5
|
-
* Carries `retryable` because the difference between a transient D1 lock and a
|
|
6
|
-
* constraint violation is invisible in the message — the caller's retry
|
|
7
|
-
* decision (the DAO's) is encoded here as a flag instead of re-parsed at every
|
|
8
|
-
* boundary.
|
|
9
|
-
*/
|
|
10
|
-
class DatabaseError extends InternalServerError {
|
|
11
|
-
constructor(message, retryable = false, options) {
|
|
12
|
-
super(message ?? 'The system encountered an unexpected problem while accessing the database.', options);
|
|
13
|
-
this.retryable = retryable;
|
|
14
|
-
this.type = 'DatabaseError';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export { DatabaseError };
|
|
18
|
-
//# sourceMappingURL=DatabaseError.js.map
|
|
1
|
+
import{InternalServerError as a}from"./InternalServerError.js";class s extends a{constructor(e,r=!1,t){super(e??"The system encountered an unexpected problem while accessing the database.",t),this.retryable=r,this.type="DatabaseError"}}export{s as DatabaseError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/DatabaseError.ts"],
|
|
4
|
+
"sourcesContent": ["import { InternalServerError } from './InternalServerError.ts';\n\n/**\n * 500 for data-layer failures.\n *\n * Carries `retryable` because the difference between a transient D1 lock and a\n * constraint violation is invisible in the message — the caller's retry\n * decision (the DAO's) is encoded here as a flag instead of re-parsed at every\n * boundary.\n */\nclass DatabaseError extends InternalServerError {\n constructor(message?: string, retryable: boolean = false, options?: { cause?: unknown }) {\n super(message ?? 'The system encountered an unexpected problem while accessing the database.', options);\n this.retryable = retryable;\n this.type = 'DatabaseError';\n }\n}\n\nexport { DatabaseError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,uBAAAA,MAA2B,2BAUpC,MAAMC,UAAsBD,CAAmB,CAC7C,YAAYE,EAAkBC,EAAqB,GAAOC,EAA6B,CACrF,MAAMF,GAAW,6EAA8EE,CAAO,EACtG,KAAK,UAAYD,EACjB,KAAK,KAAO,eACd",
|
|
6
|
+
"names": ["InternalServerError", "DatabaseError", "message", "retryable", "options"]
|
|
7
|
+
}
|
package/dist/ErrorResponse.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/ForbiddenError.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 403 — the caller is authenticated but the action is not theirs to take.
|
|
4
|
-
*/
|
|
5
|
-
class ForbiddenError extends HttpServiceError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super('Forbidden', message);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export { ForbiddenError };
|
|
11
|
-
//# sourceMappingURL=ForbiddenError.js.map
|
|
1
|
+
import{HttpServiceError as o}from"./HttpServiceError.js";class e extends o{constructor(r){super("Forbidden",r)}}export{e as ForbiddenError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ForbiddenError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 403 — the caller is authenticated but the action is not theirs to take.\n */\nclass ForbiddenError extends HttpServiceError<'Forbidden'> {\n constructor(message?: string) {\n super('Forbidden', message);\n }\n}\n\nexport { ForbiddenError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAKjC,MAAMC,UAAuBD,CAA6B,CACxD,YAAYE,EAAgB,CAC1B,MAAM,YAAaA,CAAO,CAC5B",
|
|
6
|
+
"names": ["HttpServiceError", "ForbiddenError", "message"]
|
|
7
|
+
}
|
package/dist/HttpServiceError.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ServiceError } from "./ServiceError.js";
|
|
3
|
-
/**
|
|
4
|
-
* A `ServiceError` with a fixed HTTP status and type from the catalog.
|
|
5
|
-
*
|
|
6
|
-
* Concrete subclasses add nothing but a name, so they are one-liners:
|
|
7
|
-
* `class NotFoundError extends HttpServiceError<'NotFound'> {}`.
|
|
8
|
-
*/
|
|
9
|
-
class HttpServiceError extends ServiceError {
|
|
10
|
-
constructor(errorType, message, options) {
|
|
11
|
-
const definition = CATALOG[errorType];
|
|
12
|
-
super(definition.status, errorType, message ?? definition.defaultMessage, options);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export { HttpServiceError };
|
|
16
|
-
//# sourceMappingURL=HttpServiceError.js.map
|
|
1
|
+
import{CATALOG as s}from"./CATALOG.js";import{ServiceError as i}from"./ServiceError.js";class c extends i{constructor(r,e,o){const t=s[r];super(t.status,r,e??t.defaultMessage,o)}}export{c as HttpServiceError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/HttpServiceError.ts"],
|
|
4
|
+
"sourcesContent": ["import { CATALOG } from './CATALOG.ts';\nimport type { HttpErrorType } from './CATALOG.ts';\nimport { ServiceError } from './ServiceError.ts';\nimport type { ServiceErrorOptions } from './ServiceError.ts';\n\n/**\n * A `ServiceError` with a fixed HTTP status and type from the catalog.\n *\n * Concrete subclasses add nothing but a name, so they are one-liners:\n * `class NotFoundError extends HttpServiceError<'NotFound'> {}`.\n */\nabstract class HttpServiceError<TType extends HttpErrorType> extends ServiceError {\n constructor(errorType: TType, message?: string, options?: ServiceErrorOptions) {\n const definition = CATALOG[errorType];\n super(definition.status, errorType, message ?? definition.defaultMessage, options);\n }\n}\n\nexport { HttpServiceError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,WAAAA,MAAe,eAExB,OAAS,gBAAAC,MAAoB,oBAS7B,MAAeC,UAAsDD,CAAY,CAC/E,YAAYE,EAAkBC,EAAkBC,EAA6B,CAC3E,MAAMC,EAAaN,EAAQG,CAAS,EACpC,MAAMG,EAAW,OAAQH,EAAWC,GAAWE,EAAW,eAAgBD,CAAO,CACnF",
|
|
6
|
+
"names": ["CATALOG", "ServiceError", "HttpServiceError", "errorType", "message", "options", "definition"]
|
|
7
|
+
}
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 500 — the catch-all server fault.
|
|
4
|
-
*/
|
|
5
|
-
class InternalServerError extends HttpServiceError {
|
|
6
|
-
constructor(message, options) {
|
|
7
|
-
super('InternalServerError', message, options);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* The instance returned to callers when the real cause must not be disclosed:
|
|
12
|
-
* same stable type, generic message, regardless of what failed.
|
|
13
|
-
*/
|
|
14
|
-
const DefaultInternalServerError = new InternalServerError();
|
|
15
|
-
export { InternalServerError, DefaultInternalServerError };
|
|
16
|
-
//# sourceMappingURL=InternalServerError.js.map
|
|
1
|
+
import{HttpServiceError as n}from"./HttpServiceError.js";class r extends n{constructor(e,t){super("InternalServerError",e,t)}}const o=new r;export{o as DefaultInternalServerError,r as InternalServerError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/InternalServerError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 500 — the catch-all server fault.\n */\nclass InternalServerError extends HttpServiceError<'InternalServerError'> {\n constructor(message?: string, options?: { cause?: unknown }) {\n super('InternalServerError', message, options);\n }\n}\n\n/**\n * The instance returned to callers when the real cause must not be disclosed:\n * same stable type, generic message, regardless of what failed.\n */\nconst DefaultInternalServerError = new InternalServerError();\n\nexport { InternalServerError, DefaultInternalServerError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAKjC,MAAMC,UAA4BD,CAAuC,CACvE,YAAYE,EAAkBC,EAA6B,CACzD,MAAM,sBAAuBD,EAASC,CAAO,CAC/C,EAOF,MAAMC,EAA6B,IAAIH",
|
|
6
|
+
"names": ["HttpServiceError", "InternalServerError", "message", "options", "DefaultInternalServerError"]
|
|
7
|
+
}
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 405 — the method exists but not on this path.
|
|
4
|
-
*/
|
|
5
|
-
class MethodNotAllowedError extends HttpServiceError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super('MethodNotAllowed', message);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export { MethodNotAllowedError };
|
|
11
|
-
//# sourceMappingURL=MethodNotAllowedError.js.map
|
|
1
|
+
import{HttpServiceError as r}from"./HttpServiceError.js";class t extends r{constructor(o){super("MethodNotAllowed",o)}}export{t as MethodNotAllowedError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/MethodNotAllowedError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 405 — the method exists but not on this path.\n */\nclass MethodNotAllowedError extends HttpServiceError<'MethodNotAllowed'> {\n constructor(message?: string) {\n super('MethodNotAllowed', message);\n }\n}\n\nexport { MethodNotAllowedError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAKjC,MAAMC,UAA8BD,CAAoC,CACtE,YAAYE,EAAgB,CAC1B,MAAM,mBAAoBA,CAAO,CACnC",
|
|
6
|
+
"names": ["HttpServiceError", "MethodNotAllowedError", "message"]
|
|
7
|
+
}
|
package/dist/NotFoundError.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 404 — no such resource.
|
|
4
|
-
*/
|
|
5
|
-
class NotFoundError extends HttpServiceError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super('NotFound', message);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export { NotFoundError };
|
|
11
|
-
//# sourceMappingURL=NotFoundError.js.map
|
|
1
|
+
import{HttpServiceError as o}from"./HttpServiceError.js";class t extends o{constructor(r){super("NotFound",r)}}export{t as NotFoundError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/NotFoundError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 404 — no such resource.\n */\nclass NotFoundError extends HttpServiceError<'NotFound'> {\n constructor(message?: string) {\n super('NotFound', message);\n }\n}\n\nexport { NotFoundError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAKjC,MAAMC,UAAsBD,CAA4B,CACtD,YAAYE,EAAgB,CAC1B,MAAM,WAAYA,CAAO,CAC3B",
|
|
6
|
+
"names": ["HttpServiceError", "NotFoundError", "message"]
|
|
7
|
+
}
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* 501 — the functionality exists in the protocol but not on this deployment.
|
|
4
|
-
*/
|
|
5
|
-
class NotImplementedError extends HttpServiceError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super('NotImplemented', message);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export { NotImplementedError };
|
|
11
|
-
//# sourceMappingURL=NotImplementedError.js.map
|
|
1
|
+
import{HttpServiceError as e}from"./HttpServiceError.js";class t extends e{constructor(r){super("NotImplemented",r)}}export{t as NotImplementedError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/NotImplementedError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 501 — the functionality exists in the protocol but not on this deployment.\n */\nclass NotImplementedError extends HttpServiceError<'NotImplemented'> {\n constructor(message?: string) {\n super('NotImplemented', message);\n }\n}\n\nexport { NotImplementedError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAKjC,MAAMC,UAA4BD,CAAkC,CAClE,YAAYE,EAAgB,CAC1B,MAAM,iBAAkBA,CAAO,CACjC",
|
|
6
|
+
"names": ["HttpServiceError", "NotImplementedError", "message"]
|
|
7
|
+
}
|
package/dist/OutcomeError.js
CHANGED
|
@@ -1,50 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import{ServiceError as d}from"./ServiceError.js";class n extends d{constructor(o,e){super(e.retryable?502:400,new.target.name,o,e)}}class s extends n{constructor(o,e){super(o,{retryable:!0,...e!==void 0&&{expose:e<500}}),e!==void 0&&(this.status=e)}}class t extends n{constructor(o,e){super(o,{retryable:!1,...e!==void 0&&{expose:e<500}}),e!==void 0&&(this.status=e)}}class l extends s{}class a extends t{}class c extends s{}class i extends t{}export{t as NonRetryableError,i as OAuth2TokenNonRetryableError,c as OAuth2TokenRetryableError,n as OutcomeError,a as ProviderApiNonRetryableError,l as ProviderApiRetryableError,s as RetryableError};
|
package/dist/OutcomeError.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/OutcomeError.ts"],
|
|
4
|
+
"sourcesContent": ["import { ServiceError } from './ServiceError.ts';\nimport type { ServiceErrorOptions } from './ServiceError.ts';\n\n/**\n * An error whose retryability is decided by the thrower, not deduced.\n *\n * Durable-DAV's `D1ErrorClassifier` can classify a raw D1 message, but a\n * provider-level failure (OAuth2 grant revoked, upstream API rejecting a\n * payload) carries no such signal — only the code that made the call knows.\n * This taxonomy lets that code say so explicitly, and the status defaults\n * follow the retry flag rather than a name-lookup table that could disagree.\n */\nclass OutcomeError extends ServiceError {\n constructor(message: string, options: ServiceErrorOptions & { retryable: boolean }) {\n super(options.retryable ? 502 : 400, new.target.name, message, options);\n }\n}\n\n/**\n * Transient upstream failure: a later attempt may succeed (throttling, 5xx\n * from the provider, token refresh race). Status 502 by default.\n */\nclass RetryableError extends OutcomeError {\n constructor(message: string, status?: number) {\n super(message, { retryable: true, ...(status !== undefined && { expose: status < 500 }) });\n if (status !== undefined) {\n this.status = status;\n }\n }\n}\n\n/**\n * Permanent failure: retrying repeats the failure forever. A revoked grant\n * retried every ten minutes told the caller the request was a server fault;\n * this class exists so that never reads as retryable again. Status 400.\n */\nclass NonRetryableError extends OutcomeError {\n constructor(message: string, status?: number) {\n super(message, { retryable: false, ...(status !== undefined && { expose: status < 500 }) });\n if (status !== undefined) {\n this.status = status;\n }\n }\n}\n\nclass ProviderApiRetryableError extends RetryableError {}\nclass ProviderApiNonRetryableError extends NonRetryableError {}\nclass OAuth2TokenRetryableError extends RetryableError {}\nclass OAuth2TokenNonRetryableError extends NonRetryableError {}\n\nexport {\n NonRetryableError,\n OAuth2TokenNonRetryableError,\n OAuth2TokenRetryableError,\n OutcomeError,\n ProviderApiNonRetryableError,\n ProviderApiRetryableError,\n RetryableError,\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,oBAY7B,MAAMC,UAAqBD,CAAY,CACrC,YAAYE,EAAiBC,EAAqD,CAChF,MAAMA,EAAQ,UAAY,IAAM,IAAK,WAAW,KAAMD,EAASC,CAAO,CACxE,EAOF,MAAMC,UAAuBH,CAAY,CACvC,YAAYC,EAAiBG,EAAe,CAC1C,MAAMH,EAAS,CAAE,UAAW,GAAM,GAAIG,IAAW,QAAa,CAAE,OAAQA,EAAS,GAAG,CAAG,CAAE,EACrFA,IAAW,SACb,KAAK,OAASA,EAElB,EAQF,MAAMC,UAA0BL,CAAY,CAC1C,YAAYC,EAAiBG,EAAe,CAC1C,MAAMH,EAAS,CAAE,UAAW,GAAO,GAAIG,IAAW,QAAa,CAAE,OAAQA,EAAS,GAAG,CAAG,CAAE,EACtFA,IAAW,SACb,KAAK,OAASA,EAElB,EAGF,MAAME,UAAkCH,CAAc,EACtD,MAAMI,UAAqCF,CAAiB,EAC5D,MAAMG,UAAkCL,CAAc,EACtD,MAAMM,UAAqCJ,CAAiB",
|
|
6
|
+
"names": ["ServiceError", "OutcomeError", "message", "options", "RetryableError", "status", "NonRetryableError", "ProviderApiRetryableError", "ProviderApiNonRetryableError", "OAuth2TokenRetryableError", "OAuth2TokenNonRetryableError"]
|
|
7
|
+
}
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import{HttpServiceError as o}from"./HttpServiceError.js";class e extends o{constructor(r){super("PayloadTooLarge",r)}}export{e as PayloadTooLargeError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/PayloadTooLargeError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 413 — the payload exceeds the server's limits (request body, file, batch).\n */\nclass PayloadTooLargeError extends HttpServiceError<'PayloadTooLarge'> {\n constructor(message?: string) {\n super('PayloadTooLarge', message);\n }\n}\n\nexport { PayloadTooLargeError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAKjC,MAAMC,UAA6BD,CAAmC,CACpE,YAAYE,EAAgB,CAC1B,MAAM,kBAAmBA,CAAO,CAClC",
|
|
6
|
+
"names": ["HttpServiceError", "PayloadTooLargeError", "message"]
|
|
7
|
+
}
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import{HttpServiceError as o}from"./HttpServiceError.js";class e extends o{constructor(r){super("PreconditionFailed",r)}}export{e as PreconditionFailedError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/PreconditionFailedError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 412 — a precondition the caller supplied (e.g. `If-Match`, expected state)\n * did not hold. Retrying unmodified fails by definition.\n */\nclass PreconditionFailedError extends HttpServiceError<'PreconditionFailed'> {\n constructor(message?: string) {\n super('PreconditionFailed', message);\n }\n}\n\nexport { PreconditionFailedError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAMjC,MAAMC,UAAgCD,CAAsC,CAC1E,YAAYE,EAAgB,CAC1B,MAAM,qBAAsBA,CAAO,CACrC",
|
|
6
|
+
"names": ["HttpServiceError", "PreconditionFailedError", "message"]
|
|
7
|
+
}
|
package/dist/RateLimitedError.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import{HttpServiceError as t}from"./HttpServiceError.js";class e extends t{constructor(r){super("RateLimited",r)}}export{e as RateLimitedError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/RateLimitedError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 429 — the caller exceeded its rate budget. Retrying is not just futile but\n * punished; honor `retryAfter`-style backoff at the caller.\n */\nclass RateLimitedError extends HttpServiceError<'RateLimited'> {\n constructor(message?: string) {\n super('RateLimited', message);\n }\n}\n\nexport { RateLimitedError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAMjC,MAAMC,UAAyBD,CAA+B,CAC5D,YAAYE,EAAgB,CAC1B,MAAM,cAAeA,CAAO,CAC9B",
|
|
6
|
+
"names": ["HttpServiceError", "RateLimitedError", "message"]
|
|
7
|
+
}
|
package/dist/ServiceError.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { ErrorResponse } from './ErrorResponse.ts';
|
|
2
2
|
interface ServiceErrorOptions {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
Marks a transient failure: a caller retrying is meaningful.
|
|
5
|
+
*/
|
|
4
6
|
retryable?: boolean;
|
|
5
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
Whether the raw message may reach a client. Defaults to `status < 500`.
|
|
9
|
+
*/
|
|
6
10
|
expose?: boolean;
|
|
7
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
Underlying cause, preserved for operator-facing logs.
|
|
13
|
+
*/
|
|
8
14
|
cause?: unknown;
|
|
9
15
|
}
|
|
10
16
|
interface ErrorHttpPayload {
|
|
@@ -24,13 +30,21 @@ interface ErrorHttpPayload {
|
|
|
24
30
|
* than they were ever written.
|
|
25
31
|
*/
|
|
26
32
|
declare abstract class ServiceError extends Error {
|
|
27
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
The HTTP status. Defaults from the catalog; a subclass may refine it.
|
|
35
|
+
*/
|
|
28
36
|
status: number;
|
|
29
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
Overridable by subclasses whose identity differs from the HTTP class name.
|
|
39
|
+
*/
|
|
30
40
|
type: string;
|
|
31
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
False by default: retrying is the exception, not the rule.
|
|
43
|
+
*/
|
|
32
44
|
retryable: boolean;
|
|
33
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
Whether the raw message may reach a client. Defaults to `status < 500`.
|
|
47
|
+
*/
|
|
34
48
|
expose: boolean;
|
|
35
49
|
constructor(status: number, type: string, message: string, options?: ServiceErrorOptions);
|
|
36
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceError.d.ts","sourceRoot":"","sources":["../src/ServiceError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,UAAU,mBAAmB;IAC3B
|
|
1
|
+
{"version":3,"file":"ServiceError.d.ts","sourceRoot":"","sources":["../src/ServiceError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,UAAU,mBAAmB;IAC3B;;MAEE;IACF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;MAEE;IACF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;MAEE;IACF,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;;MAEE;IACK,MAAM,EAAE,MAAM,CAAC;IAEtB;;MAEE;IACK,IAAI,EAAE,MAAM,CAAC;IAEpB;;MAEE;IACK,SAAS,EAAE,OAAO,CAAC;IAE1B;;MAEE;IACK,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"}
|
package/dist/ServiceError.js
CHANGED
|
@@ -1,84 +1 @@
|
|
|
1
|
-
const
|
|
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
|
|
1
|
+
const u="The server encountered an internal error and was unable to complete your request.";class t extends Error{status;type;retryable;expose;constructor(e,r,a,s){super(a),this.name=new.target.name,this.status=e,this.type=r,this.retryable=s?.retryable??!1,this.expose=s?.expose??e<500,s?.cause!==void 0&&(this.cause=s.cause)}toErrorResponse(){const e=this.expose?this.message:u;return{status:this.status,body:{Exception:{Type:this.type,Message:e}}}}static from(e){return e instanceof t?e:e instanceof Error?new n(e.message,{cause:e}):new n(String(e),{cause:e})}}class n extends t{constructor(e,r){super(500,"InternalError",e,r)}}export{n as InternalServiceError,t as ServiceError};
|
package/dist/ServiceError.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ServiceError.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ErrorResponse } from './ErrorResponse.ts';\n\ninterface ServiceErrorOptions {\n /**\n Marks a transient failure: a caller retrying is meaningful.\n */\n retryable?: boolean;\n /**\n Whether the raw message may reach a client. Defaults to `status < 500`.\n */\n expose?: boolean;\n /**\n Underlying cause, preserved for operator-facing logs.\n */\n cause?: unknown;\n}\n\ninterface ErrorHttpPayload {\n status: number;\n body: ErrorResponse;\n}\n\nconst INTERNAL_SERVER_MESSAGE = 'The server encountered an internal error and was unable to complete your request.';\n\n/**\n * Root of the error taxonomy.\n *\n * Every boundary in the family (route handlers, middleware, background tasks)\n * branches on `instanceof ServiceError`, so every concrete error must genuinely\n * extend it — an `implements` leaves the prototype chain broken and silently\n * masks typed errors as generic 500s.\n *\n * Status/type/retryable/expose are public fields, not methods: the values are\n * fixed at construction, and callers in all nine repos read them far more often\n * than they were ever written.\n */\nabstract class ServiceError extends Error {\n /**\n The HTTP status. Defaults from the catalog; a subclass may refine it.\n */\n public status: number;\n\n /**\n Overridable by subclasses whose identity differs from the HTTP class name.\n */\n public type: string;\n\n /**\n False by default: retrying is the exception, not the rule.\n */\n public retryable: boolean;\n\n /**\n Whether the raw message may reach a client. Defaults to `status < 500`.\n */\n public expose: boolean;\n\n constructor(status: number, type: string, message: string, options?: ServiceErrorOptions) {\n super(message);\n // `new.target.name` rather than the passed type: a subclass reports itself\n // even if its author forgot to name it, so log lines and client payloads\n // never disagree about what failed.\n this.name = new.target.name;\n this.status = status;\n this.type = type;\n this.retryable = options?.retryable ?? false;\n this.expose = options?.expose ?? status < 500;\n if (options?.cause !== undefined) {\n this.cause = options.cause;\n }\n }\n\n /**\n * The wire form: status plus the family's `ErrorResponse` envelope.\n *\n * A non-exposing error (5xx) has its message substituted — `message` is for\n * operators, and pushing it to clients leaks internals. The substitution\n * lives here, once, rather than in nine boundary mappers.\n */\n public toErrorResponse(): ErrorHttpPayload {\n const message: string = this.expose ? this.message : INTERNAL_SERVER_MESSAGE;\n return {\n status: this.status,\n body: {\n Exception: {\n Type: this.type,\n Message: message,\n },\n },\n };\n }\n\n /**\n * Normalize an unknown catch-block value into the taxonomy.\n *\n * A `ServiceError` passes through untouched (re-wrapping would bury its\n * context); anything else becomes a non-retryable 500 carrying the original\n * message and cause. Boundary code should call this before mapping an error\n * to a response, so `error instanceof ServiceError` is guaranteed downstream.\n */\n public static from(error: unknown): ServiceError {\n if (error instanceof ServiceError) {\n return error;\n }\n if (error instanceof Error) {\n return new InternalServiceError(error.message, { cause: error });\n }\n return new InternalServiceError(String(error), { cause: error });\n }\n}\n\n/**\n * Private throwable used by `ServiceError.from` for pass-through wrapping.\n * Not exported: reach `InternalServerError` for the public 500.\n */\nclass InternalServiceError extends ServiceError {\n constructor(message: string, options?: ServiceErrorOptions) {\n super(500, 'InternalError', message, options);\n }\n}\n\nexport { ServiceError, InternalServiceError };\nexport type { ServiceErrorOptions, ErrorHttpPayload };\n"],
|
|
5
|
+
"mappings": "AAsBA,MAAMA,EAA0B,oFAchC,MAAeC,UAAqB,KAAK,CAIhC,OAKA,KAKA,UAKA,OAEP,YAAYC,EAAgBC,EAAcC,EAAiBC,EAA6B,CACtF,MAAMD,CAAO,EAIb,KAAK,KAAO,WAAW,KACvB,KAAK,OAASF,EACd,KAAK,KAAOC,EACZ,KAAK,UAAYE,GAAS,WAAa,GACvC,KAAK,OAASA,GAAS,QAAUH,EAAS,IACtCG,GAAS,QAAU,SACrB,KAAK,MAAQA,EAAQ,MAEzB,CASO,iBAAe,CACpB,MAAMD,EAAkB,KAAK,OAAS,KAAK,QAAUJ,EACrD,MAAO,CACL,OAAQ,KAAK,OACb,KAAM,CACJ,UAAW,CACT,KAAM,KAAK,KACX,QAASI,IAIjB,CAUO,OAAO,KAAKE,EAAc,CAC/B,OAAIA,aAAiBL,EACZK,EAELA,aAAiB,MACZ,IAAIC,EAAqBD,EAAM,QAAS,CAAE,MAAOA,CAAK,CAAE,EAE1D,IAAIC,EAAqB,OAAOD,CAAK,EAAG,CAAE,MAAOA,CAAK,CAAE,CACjE,EAOF,MAAMC,UAA6BN,CAAY,CAC7C,YAAYG,EAAiBC,EAA6B,CACxD,MAAM,IAAK,gBAAiBD,EAASC,CAAO,CAC9C",
|
|
6
|
+
"names": ["INTERNAL_SERVER_MESSAGE", "ServiceError", "status", "type", "message", "options", "error", "InternalServiceError"]
|
|
7
|
+
}
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import{HttpServiceError as e}from"./HttpServiceError.js";class a extends e{constructor(r){super("ServiceUnavailable",r)}}export{a as ServiceUnavailableError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ServiceUnavailableError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 503 — unavailable now, healthy later. The natural status for retryable\n * infrastructure failures (a locked D1, an overloaded upstream).\n */\nclass ServiceUnavailableError extends HttpServiceError<'ServiceUnavailable'> {\n constructor(message?: string) {\n super('ServiceUnavailable', message);\n }\n}\n\nexport { ServiceUnavailableError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAMjC,MAAMC,UAAgCD,CAAsC,CAC1E,YAAYE,EAAgB,CAC1B,MAAM,qBAAsBA,CAAO,CACrC",
|
|
6
|
+
"names": ["HttpServiceError", "ServiceUnavailableError", "message"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PayloadTooLargeError } from './PayloadTooLargeError.ts';
|
|
2
|
+
/**
|
|
3
|
+
* 413 for invocations that asked for more work than one Worker invocation can issue.
|
|
4
|
+
*
|
|
5
|
+
* Converged from Edge-Sonic's `SubrequestBudgetExhaustedError`: a scan's index
|
|
6
|
+
* write is resumable (the folder stays on the frontier, so a truncated batch is
|
|
7
|
+
* reported rather than raised), but a play queue is all-or-nothing — half a
|
|
8
|
+
* queue is a shorter queue, which is a wrong answer rather than an unfinished
|
|
9
|
+
* one. Those writes refuse to start rather than starting and stopping.
|
|
10
|
+
*
|
|
11
|
+
* Shares `PayloadTooLarge`'s status (the request is well-formed; only its size
|
|
12
|
+
* exceeds what this plan serves in one invocation) with a distinct `type`,
|
|
13
|
+
* following the `DatabaseError` precedent: the catalog keeps one row per
|
|
14
|
+
* status, and the specialization overrides `type` rather than adding a second
|
|
15
|
+
* 413 row that would break the catalog's unique-status invariant. The remedy is
|
|
16
|
+
* the same shape as `PayloadTooLargeError` — ask for less in one request.
|
|
17
|
+
*/
|
|
18
|
+
declare class SubrequestBudgetExhaustedError extends PayloadTooLargeError {
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
export { SubrequestBudgetExhaustedError };
|
|
22
|
+
//# sourceMappingURL=SubrequestBudgetExhaustedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubrequestBudgetExhaustedError.d.ts","sourceRoot":"","sources":["../src/SubrequestBudgetExhaustedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;;;;;;;;GAeG;AACH,cAAM,8BAA+B,SAAQ,oBAAoB;gBACnD,OAAO,CAAC,EAAE,MAAM;CAI7B;AAED,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{PayloadTooLargeError as r}from"./PayloadTooLargeError.js";class t extends r{constructor(e){super(e??"This request asks for more database work than one invocation can issue. Send fewer items at once."),this.type="SubrequestBudgetExhausted"}}export{t as SubrequestBudgetExhaustedError};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/SubrequestBudgetExhaustedError.ts"],
|
|
4
|
+
"sourcesContent": ["import { PayloadTooLargeError } from './PayloadTooLargeError.ts';\n\n/**\n * 413 for invocations that asked for more work than one Worker invocation can issue.\n *\n * Converged from Edge-Sonic's `SubrequestBudgetExhaustedError`: a scan's index\n * write is resumable (the folder stays on the frontier, so a truncated batch is\n * reported rather than raised), but a play queue is all-or-nothing — half a\n * queue is a shorter queue, which is a wrong answer rather than an unfinished\n * one. Those writes refuse to start rather than starting and stopping.\n *\n * Shares `PayloadTooLarge`'s status (the request is well-formed; only its size\n * exceeds what this plan serves in one invocation) with a distinct `type`,\n * following the `DatabaseError` precedent: the catalog keeps one row per\n * status, and the specialization overrides `type` rather than adding a second\n * 413 row that would break the catalog's unique-status invariant. The remedy is\n * the same shape as `PayloadTooLargeError` — ask for less in one request.\n */\nclass SubrequestBudgetExhaustedError extends PayloadTooLargeError {\n constructor(message?: string) {\n super(message ?? 'This request asks for more database work than one invocation can issue. Send fewer items at once.');\n this.type = 'SubrequestBudgetExhausted';\n }\n}\n\nexport { SubrequestBudgetExhaustedError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,wBAAAA,MAA4B,4BAkBrC,MAAMC,UAAuCD,CAAoB,CAC/D,YAAYE,EAAgB,CAC1B,MAAMA,GAAW,mGAAmG,EACpH,KAAK,KAAO,2BACd",
|
|
6
|
+
"names": ["PayloadTooLargeError", "SubrequestBudgetExhaustedError", "message"]
|
|
7
|
+
}
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import{HttpServiceError as o}from"./HttpServiceError.js";class t extends o{constructor(r){super("Unauthorized",r)}}export{t as UnauthorizedError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/UnauthorizedError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 401 — credentials missing, expired, or rejected. Distinct from `Forbidden`:\n * re-authenticating may help; `Forbidden` it will not.\n */\nclass UnauthorizedError extends HttpServiceError<'Unauthorized'> {\n constructor(message?: string) {\n super('Unauthorized', message);\n }\n}\n\nexport { UnauthorizedError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAMjC,MAAMC,UAA0BD,CAAgC,CAC9D,YAAYE,EAAgB,CAC1B,MAAM,eAAgBA,CAAO,CAC/B",
|
|
6
|
+
"names": ["HttpServiceError", "UnauthorizedError", "message"]
|
|
7
|
+
}
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import{HttpServiceError as e}from"./HttpServiceError.js";class p extends e{constructor(r){super("UnsupportedMediaType",r)}}export{p as UnsupportedMediaTypeError};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/UnsupportedMediaTypeError.ts"],
|
|
4
|
+
"sourcesContent": ["import { HttpServiceError } from './HttpServiceError.ts';\n\n/**\n * 415 — the body's content type is not one the endpoint can parse.\n */\nclass UnsupportedMediaTypeError extends HttpServiceError<'UnsupportedMediaType'> {\n constructor(message?: string) {\n super('UnsupportedMediaType', message);\n }\n}\n\nexport { UnsupportedMediaTypeError };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,wBAKjC,MAAMC,UAAkCD,CAAwC,CAC9E,YAAYE,EAAgB,CAC1B,MAAM,uBAAwBA,CAAO,CACvC",
|
|
6
|
+
"names": ["HttpServiceError", "UnsupportedMediaTypeError", "message"]
|
|
7
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { MethodNotAllowedError } from './MethodNotAllowedError.ts';
|
|
|
11
11
|
export { ConflictError } from './ConflictError.ts';
|
|
12
12
|
export { PreconditionFailedError } from './PreconditionFailedError.ts';
|
|
13
13
|
export { PayloadTooLargeError } from './PayloadTooLargeError.ts';
|
|
14
|
+
export { SubrequestBudgetExhaustedError } from './SubrequestBudgetExhaustedError.ts';
|
|
14
15
|
export { UnsupportedMediaTypeError } from './UnsupportedMediaTypeError.ts';
|
|
15
16
|
export { RateLimitedError } from './RateLimitedError.ts';
|
|
16
17
|
export { InternalServerError, DefaultInternalServerError } from './InternalServerError.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,YAAY,EACZ,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,YAAY,EACZ,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { ServiceError } from "./ServiceError.js";
|
|
3
|
-
export { HttpServiceError } from "./HttpServiceError.js";
|
|
4
|
-
export { BadRequestError } from "./BadRequestError.js";
|
|
5
|
-
export { UnauthorizedError } from "./UnauthorizedError.js";
|
|
6
|
-
export { ForbiddenError } from "./ForbiddenError.js";
|
|
7
|
-
export { NotFoundError } from "./NotFoundError.js";
|
|
8
|
-
export { MethodNotAllowedError } from "./MethodNotAllowedError.js";
|
|
9
|
-
export { ConflictError } from "./ConflictError.js";
|
|
10
|
-
export { PreconditionFailedError } from "./PreconditionFailedError.js";
|
|
11
|
-
export { PayloadTooLargeError } from "./PayloadTooLargeError.js";
|
|
12
|
-
export { UnsupportedMediaTypeError } from "./UnsupportedMediaTypeError.js";
|
|
13
|
-
export { RateLimitedError } from "./RateLimitedError.js";
|
|
14
|
-
export { InternalServerError, DefaultInternalServerError } from "./InternalServerError.js";
|
|
15
|
-
export { NotImplementedError } from "./NotImplementedError.js";
|
|
16
|
-
export { BadGatewayError } from "./BadGatewayError.js";
|
|
17
|
-
export { ServiceUnavailableError } from "./ServiceUnavailableError.js";
|
|
18
|
-
export { DatabaseError } from "./DatabaseError.js";
|
|
19
|
-
export { NonRetryableError, OAuth2TokenNonRetryableError, OAuth2TokenRetryableError, OutcomeError, ProviderApiNonRetryableError, ProviderApiRetryableError, RetryableError, } from "./OutcomeError.js";
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{CATALOG as e}from"./CATALOG.js";import{ServiceError as a}from"./ServiceError.js";import{HttpServiceError as E}from"./HttpServiceError.js";import{BadRequestError as f}from"./BadRequestError.js";import{UnauthorizedError as d}from"./UnauthorizedError.js";import{ForbiddenError as i}from"./ForbiddenError.js";import{NotFoundError as u}from"./NotFoundError.js";import{MethodNotAllowedError as y}from"./MethodNotAllowedError.js";import{ConflictError as R}from"./ConflictError.js";import{PreconditionFailedError as c}from"./PreconditionFailedError.js";import{PayloadTooLargeError as S}from"./PayloadTooLargeError.js";import{SubrequestBudgetExhaustedError as s}from"./SubrequestBudgetExhaustedError.js";import{UnsupportedMediaTypeError as O}from"./UnsupportedMediaTypeError.js";import{RateLimitedError as B}from"./RateLimitedError.js";import{InternalServerError as I,DefaultInternalServerError as L}from"./InternalServerError.js";import{NotImplementedError as g}from"./NotImplementedError.js";import{BadGatewayError as q}from"./BadGatewayError.js";import{ServiceUnavailableError as C}from"./ServiceUnavailableError.js";import{DatabaseError as G}from"./DatabaseError.js";import{NonRetryableError as z,OAuth2TokenNonRetryableError as H,OAuth2TokenRetryableError as j,OutcomeError as J,ProviderApiNonRetryableError as K,ProviderApiRetryableError as Q,RetryableError as V}from"./OutcomeError.js";export{q as BadGatewayError,f as BadRequestError,e as CATALOG,R as ConflictError,G as DatabaseError,L as DefaultInternalServerError,i as ForbiddenError,E as HttpServiceError,I as InternalServerError,y as MethodNotAllowedError,z as NonRetryableError,u as NotFoundError,g as NotImplementedError,H as OAuth2TokenNonRetryableError,j as OAuth2TokenRetryableError,J as OutcomeError,S as PayloadTooLargeError,c as PreconditionFailedError,K as ProviderApiNonRetryableError,Q as ProviderApiRetryableError,B as RateLimitedError,V as RetryableError,a as ServiceError,C as ServiceUnavailableError,s as SubrequestBudgetExhaustedError,d as UnauthorizedError,O as UnsupportedMediaTypeError};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { CATALOG } from './CATALOG.ts';\nexport type { HttpErrorDefinition, HttpErrorType } from './CATALOG.ts';\nexport { ServiceError } from './ServiceError.ts';\nexport type { ServiceErrorOptions, ErrorHttpPayload } from './ServiceError.ts';\nexport { HttpServiceError } from './HttpServiceError.ts';\nexport { BadRequestError } from './BadRequestError.ts';\nexport { UnauthorizedError } from './UnauthorizedError.ts';\nexport { ForbiddenError } from './ForbiddenError.ts';\nexport { NotFoundError } from './NotFoundError.ts';\nexport { MethodNotAllowedError } from './MethodNotAllowedError.ts';\nexport { ConflictError } from './ConflictError.ts';\nexport { PreconditionFailedError } from './PreconditionFailedError.ts';\nexport { PayloadTooLargeError } from './PayloadTooLargeError.ts';\nexport { SubrequestBudgetExhaustedError } from './SubrequestBudgetExhaustedError.ts';\nexport { UnsupportedMediaTypeError } from './UnsupportedMediaTypeError.ts';\nexport { RateLimitedError } from './RateLimitedError.ts';\nexport { InternalServerError, DefaultInternalServerError } from './InternalServerError.ts';\nexport { NotImplementedError } from './NotImplementedError.ts';\nexport { BadGatewayError } from './BadGatewayError.ts';\nexport { ServiceUnavailableError } from './ServiceUnavailableError.ts';\nexport { DatabaseError } from './DatabaseError.ts';\nexport {\n NonRetryableError,\n OAuth2TokenNonRetryableError,\n OAuth2TokenRetryableError,\n OutcomeError,\n ProviderApiNonRetryableError,\n ProviderApiRetryableError,\n RetryableError,\n} from './OutcomeError.ts';\nexport type { ErrorResponse } from './ErrorResponse.ts';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,WAAAA,MAAe,eAExB,OAAS,gBAAAC,MAAoB,oBAE7B,OAAS,oBAAAC,MAAwB,wBACjC,OAAS,mBAAAC,MAAuB,uBAChC,OAAS,qBAAAC,MAAyB,yBAClC,OAAS,kBAAAC,MAAsB,sBAC/B,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,yBAAAC,MAA6B,6BACtC,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,2BAAAC,MAA+B,+BACxC,OAAS,wBAAAC,MAA4B,4BACrC,OAAS,kCAAAC,MAAsC,sCAC/C,OAAS,6BAAAC,MAAiC,iCAC1C,OAAS,oBAAAC,MAAwB,wBACjC,OAAS,uBAAAC,EAAqB,8BAAAC,MAAkC,2BAChE,OAAS,uBAAAC,MAA2B,2BACpC,OAAS,mBAAAC,MAAuB,uBAChC,OAAS,2BAAAC,MAA+B,+BACxC,OAAS,iBAAAC,MAAqB,qBAC9B,OACE,qBAAAC,EACA,gCAAAC,EACA,6BAAAC,EACA,gBAAAC,EACA,gCAAAC,EACA,6BAAAC,EACA,kBAAAC,MACK",
|
|
6
|
+
"names": ["CATALOG", "ServiceError", "HttpServiceError", "BadRequestError", "UnauthorizedError", "ForbiddenError", "NotFoundError", "MethodNotAllowedError", "ConflictError", "PreconditionFailedError", "PayloadTooLargeError", "SubrequestBudgetExhaustedError", "UnsupportedMediaTypeError", "RateLimitedError", "InternalServerError", "DefaultInternalServerError", "NotImplementedError", "BadGatewayError", "ServiceUnavailableError", "DatabaseError", "NonRetryableError", "OAuth2TokenNonRetryableError", "OAuth2TokenRetryableError", "OutcomeError", "ProviderApiNonRetryableError", "ProviderApiRetryableError", "RetryableError"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexezuge/errors",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"description": "Catalog-driven HTTP/service error taxonomy with retry markers and wire envelopes for the Rexezuge-CloudflareWorkers family.",
|
|
33
33
|
"scripts": {
|
|
34
|
-
"build": "tsc -p tsconfig.json",
|
|
34
|
+
"build": "tsc -p tsconfig.json && node ../../scripts/minify-dist.mjs",
|
|
35
35
|
"typecheck": "tsc -p tsconfig.test.json --noEmit",
|
|
36
36
|
"test": "vitest run"
|
|
37
37
|
}
|