@mcp-layer/error
Advanced tools
| /** | ||
| * Generate a stable short hashtag from name, method, and message. | ||
| * This mirrors Bento's algorithm so references remain deterministic. | ||
| * @param {string} message - Combined identity string. | ||
| * @returns {string} | ||
| */ | ||
| export function hashtag(message: string): string; | ||
| /** | ||
| * Resolve a docs URL for an error. | ||
| * @param {{ name: string, method: string, message: string, docs: string, scope: string }} input - Error identity and docs config. | ||
| * @returns {string} | ||
| */ | ||
| export function docs(input: { | ||
| name: string; | ||
| method: string; | ||
| message: string; | ||
| docs: string; | ||
| scope: string; | ||
| }): string; | ||
| /** | ||
| * @typedef {{ name: string, method: string, message: string, vars?: Record<string, unknown>, args?: Array<string | number>, docs?: string, scope?: string, cause?: unknown, [key: string]: unknown }} LayerErrorArgs | ||
| */ | ||
| /** | ||
| * Custom mcp-layer error with deterministic docs references. | ||
| */ | ||
| export class LayerError extends Error { | ||
| /** | ||
| * Create an error. | ||
| * @param {LayerErrorArgs} args - Error arguments. | ||
| */ | ||
| constructor({ name, method, message, vars, args, docs: docsBase, scope, cause, ...data }: LayerErrorArgs); | ||
| package: string; | ||
| method: string; | ||
| reference: string; | ||
| docs: string; | ||
| } | ||
| export { LayerError as MCPLayerError }; | ||
| export type LayerErrorArgs = { | ||
| name: string; | ||
| method: string; | ||
| message: string; | ||
| vars?: Record<string, unknown>; | ||
| args?: Array<string | number>; | ||
| docs?: string; | ||
| scope?: string; | ||
| cause?: unknown; | ||
| [key: string]: unknown; | ||
| }; |
+6
-2
| { | ||
| "name": "@mcp-layer/error", | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", | ||
| "description": "Documented runtime errors for mcp-layer packages.", | ||
@@ -18,4 +18,6 @@ "repository": { | ||
| "main": "src/index.js", | ||
| "types": "./types/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./types/index.d.ts", | ||
| "import": "./src/index.js", | ||
@@ -28,2 +30,3 @@ "default": "./src/index.js" | ||
| "src", | ||
| "types", | ||
| "LICENSE" | ||
@@ -35,4 +38,5 @@ ], | ||
| "scripts": { | ||
| "test": "node --test --experimental-test-coverage ./test/**/*.test.js" | ||
| "build:types": "tsc -p tsconfig.json", | ||
| "test": "node --test --experimental-test-coverage \"./test/**/*.test.js\"" | ||
| } | ||
| } |
9187
21.88%5
25%140
52.17%