@lunora/errors 1.0.0-alpha.3 → 1.0.0-alpha.5
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/packem_shared/{ERROR_CATALOG-CoCPcAHf.mjs → ERROR_CATALOG-pJvm6SQP.mjs} +4 -3
- package/dist/packem_shared/{LunoraError-CwQSmeL3.mjs → LunoraError-Cdb2-Hda.mjs} +4 -4
- package/dist/packem_shared/{invariant-DawIQfjN.mjs → invariant-HhlkSkbP.mjs} +1 -1
- package/dist/packem_shared/{toErrorBody-CyqyVwGF.mjs → toErrorBody-BXvKCSrv.mjs} +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -295,7 +295,7 @@ declare class LunoraError extends Error {
|
|
|
295
295
|
readonly title: string | undefined;
|
|
296
296
|
/** Source location, when known (mirrors `VisulimaError.loc`). */
|
|
297
297
|
readonly loc: ErrorLocation | undefined;
|
|
298
|
-
/** Machine-readable reason, keyed into
|
|
298
|
+
/** Machine-readable reason, keyed into `ERROR_CATALOG`. */
|
|
299
299
|
readonly code: string;
|
|
300
300
|
/** HTTP/RPC status for the transport mappers. */
|
|
301
301
|
readonly status: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -295,7 +295,7 @@ declare class LunoraError extends Error {
|
|
|
295
295
|
readonly title: string | undefined;
|
|
296
296
|
/** Source location, when known (mirrors `VisulimaError.loc`). */
|
|
297
297
|
readonly loc: ErrorLocation | undefined;
|
|
298
|
-
/** Machine-readable reason, keyed into
|
|
298
|
+
/** Machine-readable reason, keyed into `ERROR_CATALOG`. */
|
|
299
299
|
readonly code: string;
|
|
300
300
|
/** HTTP/RPC status for the transport mappers. */
|
|
301
301
|
readonly status: number;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { LunoraError } from './packem_shared/LunoraError-
|
|
2
|
-
export { ERROR_CATALOG, MESSAGE_SOLUTIONS, findSolutionByMessage, flattenHint, isInternalCode, resolveHint } from './packem_shared/ERROR_CATALOG-
|
|
1
|
+
export { LunoraError } from './packem_shared/LunoraError-Cdb2-Hda.mjs';
|
|
2
|
+
export { ERROR_CATALOG, MESSAGE_SOLUTIONS, findSolutionByMessage, flattenHint, isInternalCode, resolveHint } from './packem_shared/ERROR_CATALOG-pJvm6SQP.mjs';
|
|
3
3
|
export { isLunoraError } from './packem_shared/isLunoraError-CSQtYMrF.mjs';
|
|
4
|
-
export { invariant, unreachable } from './packem_shared/invariant-
|
|
5
|
-
export { toErrorBody } from './packem_shared/toErrorBody-
|
|
4
|
+
export { invariant, unreachable } from './packem_shared/invariant-HhlkSkbP.mjs';
|
|
5
|
+
export { toErrorBody } from './packem_shared/toErrorBody-BXvKCSrv.mjs';
|
|
@@ -73,7 +73,8 @@ const ERROR_CATALOG = {
|
|
|
73
73
|
R2_SQL_ERROR: { status: 502, title: "R2 SQL API error" },
|
|
74
74
|
WORKFLOWS_REST_ERROR: { status: 502, title: "Cloudflare Workflows REST API error" }
|
|
75
75
|
};
|
|
76
|
-
const
|
|
76
|
+
const getCatalogEntry = (code) => Object.hasOwn(ERROR_CATALOG, code) ? ERROR_CATALOG[code] : void 0;
|
|
77
|
+
const isInternalCode = (code) => getCatalogEntry(code)?.internal === true;
|
|
77
78
|
const MESSAGE_SOLUTIONS = [
|
|
78
79
|
{
|
|
79
80
|
body: [
|
|
@@ -213,7 +214,7 @@ const resolveHint = (input) => {
|
|
|
213
214
|
return input.hint;
|
|
214
215
|
}
|
|
215
216
|
if (input.code !== void 0) {
|
|
216
|
-
const entry =
|
|
217
|
+
const entry = getCatalogEntry(input.code);
|
|
217
218
|
if (entry?.hint !== void 0) {
|
|
218
219
|
return entry.hint;
|
|
219
220
|
}
|
|
@@ -221,4 +222,4 @@ const resolveHint = (input) => {
|
|
|
221
222
|
return input.message === void 0 ? void 0 : findSolutionByMessage(input.message)?.body;
|
|
222
223
|
};
|
|
223
224
|
|
|
224
|
-
export { ERROR_CATALOG, MESSAGE_SOLUTIONS, findSolutionByMessage, flattenHint, isInternalCode, resolveHint };
|
|
225
|
+
export { ERROR_CATALOG, MESSAGE_SOLUTIONS, findSolutionByMessage, flattenHint, getCatalogEntry, isInternalCode, resolveHint };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCatalogEntry } from './ERROR_CATALOG-pJvm6SQP.mjs';
|
|
2
2
|
|
|
3
3
|
class LunoraError extends Error {
|
|
4
4
|
/**
|
|
@@ -13,7 +13,7 @@ class LunoraError extends Error {
|
|
|
13
13
|
title;
|
|
14
14
|
/** Source location, when known (mirrors `VisulimaError.loc`). */
|
|
15
15
|
loc;
|
|
16
|
-
/** Machine-readable reason, keyed into
|
|
16
|
+
/** Machine-readable reason, keyed into `ERROR_CATALOG`. */
|
|
17
17
|
code;
|
|
18
18
|
/** HTTP/RPC status for the transport mappers. */
|
|
19
19
|
status;
|
|
@@ -22,8 +22,8 @@ class LunoraError extends Error {
|
|
|
22
22
|
/** Optional structured payload propagated verbatim to the client. */
|
|
23
23
|
data;
|
|
24
24
|
constructor(code, message, options = {}) {
|
|
25
|
-
const entry =
|
|
26
|
-
super(message ?? code, { cause: options.cause });
|
|
25
|
+
const entry = getCatalogEntry(code);
|
|
26
|
+
super(message ?? code, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
27
27
|
this.name = options.name ?? "LunoraError";
|
|
28
28
|
this.hint = options.hint ?? entry?.hint;
|
|
29
29
|
this.title = options.title ?? entry?.title;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/errors",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"description": "Unified error layer for Lunora: one LunoraError base + a central catalog of codes, statuses, and actionable hints, rendered across CLI, overlay, Studio, and the client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|