llm-large-files 0.8.1 → 0.9.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/CHANGELOG.md +631 -0
- package/README.md +9 -10
- package/dist/access.d.ts +86 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +131 -0
- package/dist/access.js.map +1 -0
- package/dist/ask.d.ts +45 -1
- package/dist/ask.d.ts.map +1 -1
- package/dist/ask.js +181 -20
- package/dist/ask.js.map +1 -1
- package/dist/cache.d.ts +12 -3
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +18 -5
- package/dist/cache.js.map +1 -1
- package/dist/encoding.js +5 -3
- package/dist/encoding.js.map +1 -1
- package/dist/error-info.d.ts +57 -0
- package/dist/error-info.d.ts.map +1 -0
- package/dist/error-info.js +217 -0
- package/dist/error-info.js.map +1 -0
- package/dist/errors.d.ts +72 -8
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +102 -15
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +35 -9
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +42 -11
- package/dist/events.js.map +1 -1
- package/dist/evidence.d.ts +4 -2
- package/dist/evidence.d.ts.map +1 -1
- package/dist/evidence.js +14 -3
- package/dist/evidence.js.map +1 -1
- package/dist/extract.d.ts +32 -8
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +46 -35
- package/dist/extract.js.map +1 -1
- package/dist/gemini/adapter.d.ts +19 -3
- package/dist/gemini/adapter.d.ts.map +1 -1
- package/dist/gemini/adapter.js +84 -12
- package/dist/gemini/adapter.js.map +1 -1
- package/dist/gemini/chat.d.ts +18 -6
- package/dist/gemini/chat.d.ts.map +1 -1
- package/dist/gemini/chat.js +2 -0
- package/dist/gemini/chat.js.map +1 -1
- package/dist/gemini/index.d.ts +1 -1
- package/dist/gemini/index.d.ts.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/ingest.d.ts +70 -0
- package/dist/ingest.d.ts.map +1 -0
- package/dist/ingest.js +868 -0
- package/dist/ingest.js.map +1 -0
- package/dist/library.d.ts +176 -34
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +332 -512
- package/dist/library.js.map +1 -1
- package/dist/limiter.d.ts +2 -2
- package/dist/limiter.js +2 -2
- package/dist/map-reduce.js +3 -3
- package/dist/map-reduce.js.map +1 -1
- package/dist/model.d.ts +43 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +63 -3
- package/dist/model.js.map +1 -1
- package/dist/node/handlers.d.ts +234 -7
- package/dist/node/handlers.d.ts.map +1 -1
- package/dist/node/handlers.js +482 -121
- package/dist/node/handlers.js.map +1 -1
- package/dist/node/index.d.ts +3 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/ingest-child.d.ts +7 -1
- package/dist/node/ingest-child.d.ts.map +1 -1
- package/dist/node/ingest-child.js +18 -3
- package/dist/node/ingest-child.js.map +1 -1
- package/dist/node/isolated.d.ts +3 -1
- package/dist/node/isolated.d.ts.map +1 -1
- package/dist/node/isolated.js +11 -4
- package/dist/node/isolated.js.map +1 -1
- package/dist/node/originals.d.ts +19 -0
- package/dist/node/originals.d.ts.map +1 -0
- package/dist/node/originals.js +82 -0
- package/dist/node/originals.js.map +1 -0
- package/dist/node/spool.d.ts +102 -0
- package/dist/node/spool.d.ts.map +1 -0
- package/dist/node/spool.js +365 -0
- package/dist/node/spool.js.map +1 -0
- package/dist/node/sse.d.ts +4 -3
- package/dist/node/sse.d.ts.map +1 -1
- package/dist/node/sse.js +7 -6
- package/dist/node/sse.js.map +1 -1
- package/dist/pdf-layout.d.ts.map +1 -1
- package/dist/pdf-layout.js +71 -12
- package/dist/pdf-layout.js.map +1 -1
- package/dist/ranged.d.ts +22 -11
- package/dist/ranged.d.ts.map +1 -1
- package/dist/ranged.js +50 -12
- package/dist/ranged.js.map +1 -1
- package/dist/retry.d.ts +3 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +6 -2
- package/dist/retry.js.map +1 -1
- package/dist/scope.d.ts +25 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +60 -0
- package/dist/scope.js.map +1 -0
- package/dist/source.d.ts +60 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +170 -0
- package/dist/source.js.map +1 -0
- package/dist/stores.d.ts +120 -31
- package/dist/stores.d.ts.map +1 -1
- package/dist/stores.js +582 -139
- package/dist/stores.js.map +1 -1
- package/dist/testing/fake-fetch.d.ts +31 -0
- package/dist/testing/fake-fetch.d.ts.map +1 -0
- package/dist/testing/fake-fetch.js +66 -0
- package/dist/testing/fake-fetch.js.map +1 -0
- package/dist/testing/fake-model.d.ts +38 -0
- package/dist/testing/fake-model.d.ts.map +1 -0
- package/dist/testing/fake-model.js +62 -0
- package/dist/testing/fake-model.js.map +1 -0
- package/dist/testing/index.d.ts +7 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +9 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/store-checks.d.ts +72 -0
- package/dist/testing/store-checks.d.ts.map +1 -0
- package/dist/testing/store-checks.js +619 -0
- package/dist/testing/store-checks.js.map +1 -0
- package/dist/tools.d.ts +25 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +135 -13
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +116 -13
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +17 -8
- package/docs/getting-started.md +18 -13
- package/docs/guides/anthropic.md +12 -8
- package/docs/guides/conversations.md +112 -47
- package/docs/guides/costs-and-limits.md +16 -7
- package/docs/guides/deployment.md +309 -87
- package/docs/guides/errors-and-reliability.md +161 -23
- package/docs/guides/own-adapter-and-loop.md +27 -10
- package/docs/guides/pdfs.md +123 -29
- package/docs/guides/storage.md +634 -143
- package/docs/guides/testing.md +78 -129
- package/docs/guides/vertex-and-gemini.md +10 -7
- package/docs/guides/web-app.md +322 -77
- package/docs/how-it-works.md +35 -8
- package/docs/measurements.md +63 -8
- package/docs/publishing.md +112 -36
- package/docs/reference/ask.md +154 -13
- package/docs/reference/errors-and-retries.md +166 -14
- package/docs/reference/events.md +53 -20
- package/docs/reference/gemini.md +70 -21
- package/docs/reference/library.md +709 -165
- package/docs/reference/node.md +633 -104
- package/docs/reference/testing.md +311 -0
- package/docs/reference/tools.md +15 -5
- package/docs/security.md +316 -70
- package/docs/troubleshooting.md +165 -58
- package/docs/upgrading-0.9.md +890 -0
- package/package.json +12 -3
- package/src/access.ts +144 -0
- package/src/ask.ts +230 -19
- package/src/cache.ts +20 -5
- package/src/encoding.ts +6 -4
- package/src/error-info.ts +255 -0
- package/src/errors.ts +129 -15
- package/src/events.ts +86 -21
- package/src/evidence.ts +14 -3
- package/src/extract.ts +50 -33
- package/src/gemini/adapter.ts +97 -11
- package/src/gemini/chat.ts +20 -6
- package/src/gemini/index.ts +1 -1
- package/src/index.ts +9 -6
- package/src/ingest.ts +927 -0
- package/src/library.ts +482 -523
- package/src/limiter.ts +2 -2
- package/src/map-reduce.ts +3 -3
- package/src/model.ts +69 -5
- package/src/node/handlers.ts +691 -117
- package/src/node/index.ts +13 -2
- package/src/node/ingest-child.ts +23 -5
- package/src/node/isolated.ts +11 -4
- package/src/node/originals.ts +78 -0
- package/src/node/spool.ts +365 -0
- package/src/node/sse.ts +7 -6
- package/src/pdf-layout.ts +69 -11
- package/src/ranged.ts +42 -14
- package/src/retry.ts +6 -2
- package/src/scope.ts +63 -0
- package/src/source.ts +178 -0
- package/src/stores.ts +635 -140
- package/src/testing/fake-fetch.ts +80 -0
- package/src/testing/fake-model.ts +78 -0
- package/src/testing/index.ts +11 -0
- package/src/testing/store-checks.ts +660 -0
- package/src/tools.ts +150 -14
- package/src/types.ts +106 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-info.d.ts","sourceRoot":"","sources":["../src/error-info.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEvG,0DAA0D;AAC1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,aAAa,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,SAAS,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAG1C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,sFAAsF,CAAC;AAsLtH;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAOrD"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// What an error means for an application: one record to choose a status, a retry and words of
|
|
2
|
+
// your own by, in any language. New in 0.9.0.
|
|
3
|
+
import { DocumentScopeError, DocumentStoreError, IngestError, isErrorCode } from "./errors.js";
|
|
4
|
+
import { eventErrorOf, isPlainData } from "./events.js";
|
|
5
|
+
import { modelFailureReason } from "./map-reduce.js";
|
|
6
|
+
import { classifyModelError, DocumentsNotFoundError, isModelStatus, ModelRequestError } from "./model.js";
|
|
7
|
+
/** How long to wait after a store failed, before the same call is made again. */
|
|
8
|
+
export const STORE_RETRY_AFTER_MS = 5_000;
|
|
9
|
+
const SOMETHING_WENT_WRONG = "Something went wrong.";
|
|
10
|
+
/**
|
|
11
|
+
* What a user is told of an "unreadable" file, whose message is a parser's or an extractor's of
|
|
12
|
+
* your own (which may name a host): by `errorInfoOf`, and by the upload handlers.
|
|
13
|
+
*/
|
|
14
|
+
export const UNREADABLE_MESSAGE = "This file could not be read. It may be damaged, or not of the type its name says.";
|
|
15
|
+
const CHAT_GONE = "This chat no longer exists.";
|
|
16
|
+
/** The HTTP status of a model error, by its kind: the answer of a server that asked a model for its user. */
|
|
17
|
+
const MODEL_STATUS = {
|
|
18
|
+
context_overflow: 413,
|
|
19
|
+
rate_limit: 429,
|
|
20
|
+
quota: 503,
|
|
21
|
+
timeout: 504,
|
|
22
|
+
unreachable: 502,
|
|
23
|
+
server: 502,
|
|
24
|
+
auth: 500,
|
|
25
|
+
invalid: 500,
|
|
26
|
+
};
|
|
27
|
+
const RETRYABLE_KINDS = new Set(["rate_limit", "timeout", "unreachable", "server"]);
|
|
28
|
+
/** Every `DocumentScopeErrorCode`, to read the `code` of an `EventError`. */
|
|
29
|
+
const SCOPE_CODES = { scope_required: true, scope_invalid: true, scope_missing: true };
|
|
30
|
+
/** Statuses of plain data that say "try again later": too many requests, and a server that could not answer. */
|
|
31
|
+
const RETRY_STATUSES = new Set([429, 502, 503, 504]);
|
|
32
|
+
/** Every `IngestErrorCode`, to read the `code` of an `EventError`. */
|
|
33
|
+
const INGEST_CODES = {
|
|
34
|
+
empty: true, too_large: true, too_much_text: true, too_many_pages: true, not_text: true, compressed: true, legacy_office: true,
|
|
35
|
+
encrypted: true, no_text: true, hostile: true, timeout: true, out_of_memory: true, busy: true, missing_dependency: true, unreadable: true, exists: true,
|
|
36
|
+
};
|
|
37
|
+
const isKind = (value) => typeof value === "string" && Object.hasOwn(MODEL_STATUS, value);
|
|
38
|
+
const isStatus = (value) => typeof value === "number" && Number.isInteger(value) && value >= 400 && value <= 599;
|
|
39
|
+
const isWait = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
40
|
+
/** The code of a Node system error (one with a `code` and a `syscall`), whose message names paths or hosts. */
|
|
41
|
+
function systemCode(error) {
|
|
42
|
+
const { code, syscall } = error;
|
|
43
|
+
return typeof syscall === "string" && isErrorCode(code) ? code : undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The kind of a model error: its own, or the one its status (0, or 400 to 599), message and code
|
|
47
|
+
* give (an error of an adapter of your own), as its `EventError` and its message have it.
|
|
48
|
+
*/
|
|
49
|
+
function modelKindOf(error) {
|
|
50
|
+
const { kind, status, message, code } = error;
|
|
51
|
+
if (isKind(kind))
|
|
52
|
+
return kind;
|
|
53
|
+
if (ModelRequestError.is(error) || isModelStatus(status)) {
|
|
54
|
+
return classifyModelError(typeof status === "number" ? status : 0, typeof message === "string" ? message : "", { code: typeof code === "string" ? code : undefined }).kind;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The code in the library's own words for a system error, as an `EventError` holds them: "The
|
|
60
|
+
* file could not be read from storage (ELOOP)." of `ingest.error` and `run.error`, "Upload failed
|
|
61
|
+
* (ENOSPC)." of the upload handlers' `ingest.error`. The error itself has the code: its event, only
|
|
62
|
+
* these words.
|
|
63
|
+
*/
|
|
64
|
+
function codeInWords(message) {
|
|
65
|
+
const code = typeof message === "string" ? /^(?:The file could not be read from storage|Upload failed) \(([A-Z][A-Z0-9_]{0,31})\)\.$/.exec(message)?.[1] : undefined;
|
|
66
|
+
return isErrorCode(code) ? code : undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Whether `message` is the library's own words for a model's error of `kind`, with any status:
|
|
70
|
+
* "The model was busy (HTTP 429).". An `EventError` holds them, and the upload handlers' names the
|
|
71
|
+
* provider's status in them and the answer's in `status` ("The model failed on its side (HTTP
|
|
72
|
+
* 503).", 502): they are kept. Any other words, a provider's, are not.
|
|
73
|
+
*/
|
|
74
|
+
function isModelWords(kind, message) {
|
|
75
|
+
if (typeof message !== "string")
|
|
76
|
+
return false;
|
|
77
|
+
const status = /\(HTTP (\d{1,3})\)\.$/.exec(message)?.[1];
|
|
78
|
+
return message === modelFailureReason({ kind, ...(status !== undefined ? { status: Number(status) } : {}) });
|
|
79
|
+
}
|
|
80
|
+
/** A refused file, from an `IngestError` or the `EventError` of one. */
|
|
81
|
+
function ingestInfo(code, status, retryAfterMs, message) {
|
|
82
|
+
return {
|
|
83
|
+
category: "ingest",
|
|
84
|
+
code,
|
|
85
|
+
status: isStatus(status) ? status : 422,
|
|
86
|
+
retryable: code === "busy",
|
|
87
|
+
...(code === "busy" && isWait(retryAfterMs) ? { retryAfterMs } : {}),
|
|
88
|
+
// An unreadable file has the parser's message, or that of an extractor of your own: not words for a user.
|
|
89
|
+
message: code === "unreadable" || typeof message !== "string" || !message ? UNREADABLE_MESSAGE : message,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const storeInfo = (code, message) => ({
|
|
93
|
+
category: "store",
|
|
94
|
+
// As the store's message does, a code is given only when it reads as one.
|
|
95
|
+
...(isErrorCode(code) ? { code } : {}),
|
|
96
|
+
status: 503,
|
|
97
|
+
retryable: true,
|
|
98
|
+
retryAfterMs: STORE_RETRY_AFTER_MS,
|
|
99
|
+
message,
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* A scope that cannot be used: a chat that is gone, or a scope the server should have given, or
|
|
103
|
+
* given right (its bug, not the user's). Its own words are not used: a store of your own wrote them.
|
|
104
|
+
*/
|
|
105
|
+
function scopeInfo(code) {
|
|
106
|
+
if (code === "scope_missing")
|
|
107
|
+
return { category: "missing", code: "scope_missing", status: 404, retryable: false, message: CHAT_GONE };
|
|
108
|
+
const known = typeof code === "string" && Object.hasOwn(SCOPE_CODES, code);
|
|
109
|
+
return { category: "input", ...(known ? { code } : {}), status: 500, retryable: false, message: SOMETHING_WENT_WRONG };
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* An `EventError`: the plain data of `run.error`, `request.end`, `retry` and `ingest.error`, which
|
|
113
|
+
* the library made from an error with words safe to show. It is read by its `name` and `code`;
|
|
114
|
+
* a model error by its `kind`, below, as any error with one. Undefined for other data.
|
|
115
|
+
*/
|
|
116
|
+
function eventInfoOf(record) {
|
|
117
|
+
const { name, code, kind, status, message } = record;
|
|
118
|
+
if (typeof message !== "string" || kind !== undefined)
|
|
119
|
+
return undefined;
|
|
120
|
+
// `ingest.error` of the upload handler has no name for a refused file.
|
|
121
|
+
if (typeof code === "string" && Object.hasOwn(INGEST_CODES, code) && (name === undefined || name === "IngestError"))
|
|
122
|
+
return ingestInfo(code, status, undefined, message);
|
|
123
|
+
if (name === "DocumentStoreError")
|
|
124
|
+
return storeInfo(undefined, message || "The document store could not be used. Try again.");
|
|
125
|
+
if (name === "DocumentsNotFoundError")
|
|
126
|
+
return { category: "missing", code: "documents_missing", status: 404, retryable: false, message: message || "A document is no longer available. Upload it again." };
|
|
127
|
+
if (name === "DocumentScopeError")
|
|
128
|
+
return scopeInfo(code);
|
|
129
|
+
// A mistake in the call, as the error itself is read (`ingest.error` of a TypeError of ingest).
|
|
130
|
+
if (name === "TypeError" || name === "RangeError")
|
|
131
|
+
return inputInfo();
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
/** A `TypeError` or `RangeError`: a mistake in the call, the server's bug and not the user's. */
|
|
135
|
+
const inputInfo = () => ({ category: "input", status: 500, retryable: false, message: SOMETHING_WENT_WRONG });
|
|
136
|
+
function infoOf(error) {
|
|
137
|
+
if (IngestError.is(error))
|
|
138
|
+
return ingestInfo(error.code, error.status, error.retryAfterMs, error.message);
|
|
139
|
+
// Written to be shown: the operation and a code, never a path or a host.
|
|
140
|
+
if (DocumentStoreError.is(error))
|
|
141
|
+
return storeInfo(error.code, eventErrorOf(error).message);
|
|
142
|
+
if (DocumentsNotFoundError.is(error)) {
|
|
143
|
+
return { category: "missing", code: "documents_missing", status: 404, retryable: false, message: eventErrorOf(error).message };
|
|
144
|
+
}
|
|
145
|
+
if (DocumentScopeError.is(error))
|
|
146
|
+
return scopeInfo(error.code);
|
|
147
|
+
if (typeof error !== "object" || error === null)
|
|
148
|
+
return { category: "unknown", status: 500, retryable: false, message: SOMETHING_WENT_WRONG };
|
|
149
|
+
const { name, retryAfterMs } = error;
|
|
150
|
+
if (name === "AbortError")
|
|
151
|
+
return { category: "aborted", code: "aborted", status: 503, retryable: true, message: "It was stopped before it finished." };
|
|
152
|
+
if (name === "TimeoutError")
|
|
153
|
+
return { category: "aborted", code: "timeout", status: 504, retryable: true, message: "It took too long, and was stopped. Try again." };
|
|
154
|
+
const plain = isPlainData(error);
|
|
155
|
+
if (plain) {
|
|
156
|
+
const fromEvent = eventInfoOf(error);
|
|
157
|
+
if (fromEvent)
|
|
158
|
+
return fromEvent;
|
|
159
|
+
// Plain data without a `kind` is not a model's error: an `EventError` of one always has its
|
|
160
|
+
// kind. The `ingest.error` of the upload handler for a hook that failed ({ message, status })
|
|
161
|
+
// keeps its status, and that of a system error its code.
|
|
162
|
+
const { kind, status, message } = error;
|
|
163
|
+
if (typeof kind !== "string")
|
|
164
|
+
return plainInfo(error, status, systemCode(error) ?? codeInWords(message));
|
|
165
|
+
}
|
|
166
|
+
const kind = modelKindOf(error);
|
|
167
|
+
if (kind !== undefined) {
|
|
168
|
+
const { message } = error;
|
|
169
|
+
return {
|
|
170
|
+
category: "model",
|
|
171
|
+
code: kind,
|
|
172
|
+
status: MODEL_STATUS[kind],
|
|
173
|
+
retryable: RETRYABLE_KINDS.has(kind),
|
|
174
|
+
...(isWait(retryAfterMs) ? { retryAfterMs } : {}),
|
|
175
|
+
// By its kind and status, never in the provider's words (eventErrorOf). The library's own
|
|
176
|
+
// words, in an EventError, are kept.
|
|
177
|
+
message: plain && isModelWords(kind, message) ? message : eventErrorOf(error).message,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (error instanceof TypeError || error instanceof RangeError)
|
|
181
|
+
return inputInfo();
|
|
182
|
+
return plainInfo(error, undefined);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Anything else: "unknown", with the code of a system error (of its event, from the library's
|
|
186
|
+
* words), never its message. `status`, of plain data, is kept when it is one of an error (400 to
|
|
187
|
+
* 599), and says whether to retry.
|
|
188
|
+
*/
|
|
189
|
+
function plainInfo(error, status, code = systemCode(error)) {
|
|
190
|
+
return {
|
|
191
|
+
category: "unknown",
|
|
192
|
+
...(code ? { code } : {}),
|
|
193
|
+
status: isStatus(status) ? status : 500,
|
|
194
|
+
retryable: RETRY_STATUSES.has(status),
|
|
195
|
+
message: code ? `Something went wrong (${code}).` : SOMETHING_WENT_WRONG,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* What an error of the library means, for an application that tells its users in its own words:
|
|
200
|
+
* its category and code, the HTTP status to answer with, whether to retry it, and a message in
|
|
201
|
+
* English that is safe to show (never a path, a host, a stack or a provider's words). It reads
|
|
202
|
+
* the errors of every copy of the package (two versions side by side, or one bundled), and the
|
|
203
|
+
* `EventError` of an event (`run.error`, `ingest.error`, the upload handlers' `ingest.error` too),
|
|
204
|
+
* by its `code`, `name` and `kind`, keeping the words the library wrote. Plain data with none of
|
|
205
|
+
* them is "unknown", with its status. It never throws: what it cannot read is "unknown". New in
|
|
206
|
+
* 0.9.0.
|
|
207
|
+
*/
|
|
208
|
+
export function errorInfoOf(error) {
|
|
209
|
+
try {
|
|
210
|
+
return infoOf(error);
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
// An error whose fields throw when read (a getter, a proxy).
|
|
214
|
+
return { category: "unknown", status: 500, retryable: false, message: SOMETHING_WENT_WRONG };
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=error-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-info.js","sourceRoot":"","sources":["../src/error-info.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,8CAA8C;AAC9C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAqD,MAAM,aAAa,CAAC;AAClJ,OAAO,EAAE,YAAY,EAAE,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AClF,OAAO,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,KAAa,EAAE,MAAe,EAAE,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC;IACzE,OAAO;QACL,QAAQ,EAAE,SAAS;QACnB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG;QACvC,SAAS,EAAE,cAAc,CAAC,GAAG,CAAC,MAAgB,CAAC;QAC/C,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,yBAAyB,IAAI,IAAI,CAAC,CAAC,CAAC,oBAAoB;KACzE,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;QAC7D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAC/F,CAAC;AACH,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,17 +1,76 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Whether `value` reads as a code (EIO, ETIMEDOUT, NEWER_VERSION): capitals, digits and "_", 32 at
|
|
3
|
+
* most. A driver may put a host in the `code` of an error ("db-prod.internal:27017"): such a code is
|
|
4
|
+
* never shown.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isErrorCode: (value: unknown) => value is string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether `value` carries the brand `key` (`Symbol.for`), which every copy of this package gives
|
|
9
|
+
* its errors of one class: `instanceof` fails for an error made by another copy of the package (two
|
|
10
|
+
* versions installed side by side, or one bundled), and the brand does not.
|
|
11
|
+
*/
|
|
12
|
+
export declare function branded(value: unknown, key: symbol): boolean;
|
|
13
|
+
/** Puts the brand `key` on the instances of a class, through its prototype (see `branded`). */
|
|
14
|
+
export declare function brand(target: {
|
|
15
|
+
prototype: object;
|
|
16
|
+
}, key: symbol): void;
|
|
17
|
+
/**
|
|
18
|
+
* What the store was doing when it failed: reading, writing a document at ingest, deleting one, or
|
|
19
|
+
* removing expired ones. New in 0.9.0.
|
|
20
|
+
*/
|
|
21
|
+
export type DocumentStoreOperation = "read" | "write" | "delete" | "sweep";
|
|
22
|
+
/**
|
|
23
|
+
* The store failed just now: a volume that did not answer, too many open files, a database that
|
|
24
|
+
* is down. It does not mean that the document is gone, and the same call may work a moment later,
|
|
25
|
+
* so retry it rather than ask the user to upload the file again.
|
|
5
26
|
*
|
|
6
27
|
* The message names no path and no host. The error that was caught is `cause`: log that one on
|
|
7
28
|
* the server, and show this one to a user or a model.
|
|
29
|
+
*
|
|
30
|
+
* New in 0.9.0: `operation` says what failed, `status` is 503, and code "NEWER_VERSION" is
|
|
31
|
+
* metadata written by a newer version of the package, which this one does not read. Before 0.9.0
|
|
32
|
+
* it was only made for reads, and `new DocumentStoreError(cause)` still makes one.
|
|
8
33
|
*/
|
|
9
34
|
export declare class DocumentStoreError extends Error {
|
|
10
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* The code of the system error behind it (`EIO`, `EMFILE`, `ETIMEDOUT`), when there is one, or
|
|
37
|
+
* the code it was made with: "NEWER_VERSION".
|
|
38
|
+
*/
|
|
11
39
|
readonly code?: string;
|
|
12
40
|
/** The system call that failed (`open`, `read`), when there is one. */
|
|
13
41
|
readonly syscall?: string;
|
|
14
|
-
|
|
42
|
+
/** What the store was doing. "read" unless it was made with another. */
|
|
43
|
+
readonly operation: DocumentStoreOperation;
|
|
44
|
+
/** The HTTP status to answer with: the server cannot serve the request now. */
|
|
45
|
+
readonly status: 503;
|
|
46
|
+
constructor(cause: unknown, options?: {
|
|
47
|
+
operation?: DocumentStoreOperation;
|
|
48
|
+
code?: string;
|
|
49
|
+
});
|
|
50
|
+
/** Whether `value` is a `DocumentStoreError`, made by this copy of the package or another one. New in 0.9.0. */
|
|
51
|
+
static is(value: unknown): value is DocumentStoreError;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Why a scope was refused (see `DocumentScopeError`):
|
|
55
|
+
* - "scope_invalid": not an array of 1 to 8 segments of 1 to 256 characters, without control
|
|
56
|
+
* characters, "/" or "\", and not "." or "..", or not one the store can keep;
|
|
57
|
+
* - "scope_required": the store needs a scope, and the call had none;
|
|
58
|
+
* - "scope_missing": the store keeps the scope in a folder that is gone (the chat was deleted).
|
|
59
|
+
*/
|
|
60
|
+
export type DocumentScopeErrorCode = "scope_required" | "scope_invalid" | "scope_missing";
|
|
61
|
+
/**
|
|
62
|
+
* A scope (`DocumentScope`) that cannot be used: one that is not valid, a call without one to a
|
|
63
|
+
* store that needs one, or a scope whose place in the store is gone. A mistake in the call, not a
|
|
64
|
+
* failure of the store: the library passes it on as it is, and retrying the same call fails again.
|
|
65
|
+
* The message names no segment of the scope. New in 0.9.0.
|
|
66
|
+
*/
|
|
67
|
+
export declare class DocumentScopeError extends TypeError {
|
|
68
|
+
readonly code: DocumentScopeErrorCode;
|
|
69
|
+
constructor(code: DocumentScopeErrorCode, message?: string, options?: {
|
|
70
|
+
cause?: unknown;
|
|
71
|
+
});
|
|
72
|
+
/** Whether `value` is a `DocumentScopeError`, made by this copy of the package or another one. */
|
|
73
|
+
static is(value: unknown): value is DocumentScopeError;
|
|
15
74
|
}
|
|
16
75
|
/** Takes note that a store threw this error while it wrote a document. */
|
|
17
76
|
export declare function noteStoreWriteFailure(error: unknown): void;
|
|
@@ -19,7 +78,8 @@ export declare function noteStoreWriteFailure(error: unknown): void;
|
|
|
19
78
|
export declare function isStoreWriteFailure(error: unknown): boolean;
|
|
20
79
|
/**
|
|
21
80
|
* What to tell a model, or a user, about an error: its message, unless it is a system error, whose
|
|
22
|
-
* message names a path or a host of the server. Of that one only the code is passed on
|
|
81
|
+
* message names a path or a host of the server. Of that one only the code is passed on, when it
|
|
82
|
+
* reads as one (`isErrorCode`).
|
|
23
83
|
*/
|
|
24
84
|
export declare function safeErrorMessage(error: unknown): string;
|
|
25
85
|
/**
|
|
@@ -45,8 +105,10 @@ export declare function safeErrorMessage(error: unknown): string;
|
|
|
45
105
|
* - "missing_dependency": the optional dependency for the format is not installed, could not be
|
|
46
106
|
* loaded, or (`unpdf`) is of a version that cannot read PDFs on this Node.
|
|
47
107
|
* - "unreadable": the file is damaged, or not of the type its name says.
|
|
108
|
+
* - "exists": a document with the ID the application gave (`IngestInput.id`) is already stored.
|
|
109
|
+
* Status 409. New in 0.9.0.
|
|
48
110
|
*/
|
|
49
|
-
export type IngestErrorCode = "empty" | "too_large" | "too_much_text" | "too_many_pages" | "not_text" | "compressed" | "legacy_office" | "encrypted" | "no_text" | "hostile" | "timeout" | "out_of_memory" | "busy" | "missing_dependency" | "unreadable";
|
|
111
|
+
export type IngestErrorCode = "empty" | "too_large" | "too_much_text" | "too_many_pages" | "not_text" | "compressed" | "legacy_office" | "encrypted" | "no_text" | "hostile" | "timeout" | "out_of_memory" | "busy" | "missing_dependency" | "unreadable" | "exists";
|
|
50
112
|
/**
|
|
51
113
|
* `ingest` could not read a file. The message says why, in words for the person who uploaded it,
|
|
52
114
|
* as it always did; `code` says it for the application. New in 0.8.0: before it, the same refusals
|
|
@@ -57,12 +119,14 @@ export declare class IngestError extends Error {
|
|
|
57
119
|
readonly code: IngestErrorCode;
|
|
58
120
|
/** For "busy": how long to wait before trying again, in milliseconds. */
|
|
59
121
|
readonly retryAfterMs?: number;
|
|
60
|
-
/** The HTTP status the upload handler answers with: 422 for a file that cannot be read, 413 for "too_large", 503 for "busy". */
|
|
122
|
+
/** The HTTP status the upload handler answers with: 422 for a file that cannot be read, 413 for "too_large", 409 for "exists", 503 for "busy". */
|
|
61
123
|
readonly status: number;
|
|
62
124
|
constructor(code: IngestErrorCode, message: string, options?: {
|
|
63
125
|
cause?: unknown;
|
|
64
126
|
retryAfterMs?: number;
|
|
65
127
|
});
|
|
128
|
+
/** Whether `value` is an `IngestError`, made by this copy of the package or another one. New in 0.9.0. */
|
|
129
|
+
static is(value: unknown): value is IngestError;
|
|
66
130
|
}
|
|
67
131
|
/**
|
|
68
132
|
* The code of a refusal of the library, from its message; "unreadable" for any other error of
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAA2E,CAAC;AAWlI;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAO5D;AAED,+FAA+F;AAC/F,wBAAgB,KAAK,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtE;AAMD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAa3E;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAC3C,+EAA+E;IAC/E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E,eAAe,CAAC;IAC/B,yEAAyE;IACzE,SAAiB,YAAY,CAAC,EAAE,MAAM,CAAC;IACvC,kJAAkJ;IAClJ,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAO;IAQ5G,0GAA0G;IAC1G,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW;CAGhD;AAwBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAGlE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMrD"}
|
package/dist/errors.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `value` reads as a code (EIO, ETIMEDOUT, NEWER_VERSION): capitals, digits and "_", 32 at
|
|
3
|
+
* most. A driver may put a host in the `code` of an error ("db-prod.internal:27017"): such a code is
|
|
4
|
+
* never shown.
|
|
5
|
+
*/
|
|
6
|
+
export const isErrorCode = (value) => typeof value === "string" && /^[A-Z][A-Z0-9_]{0,31}$/.test(value);
|
|
1
7
|
/** The code and system call of a Node system error (`EIO`, `open`), when the value is one. */
|
|
2
8
|
function systemError(value) {
|
|
3
9
|
const { code, syscall } = (value ?? {});
|
|
@@ -7,28 +13,103 @@ function systemError(value) {
|
|
|
7
13
|
};
|
|
8
14
|
}
|
|
9
15
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
16
|
+
* Whether `value` carries the brand `key` (`Symbol.for`), which every copy of this package gives
|
|
17
|
+
* its errors of one class: `instanceof` fails for an error made by another copy of the package (two
|
|
18
|
+
* versions installed side by side, or one bundled), and the brand does not.
|
|
19
|
+
*/
|
|
20
|
+
export function branded(value, key) {
|
|
21
|
+
try {
|
|
22
|
+
return typeof value === "object" && value !== null && value[key] === true;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// A proxy whose traps throw.
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Puts the brand `key` on the instances of a class, through its prototype (see `branded`). */
|
|
30
|
+
export function brand(target, key) {
|
|
31
|
+
Object.defineProperty(target.prototype, key, { value: true });
|
|
32
|
+
}
|
|
33
|
+
const DOCUMENT_STORE_ERROR = Symbol.for("llm-large-files.DocumentStoreError");
|
|
34
|
+
const DOCUMENT_SCOPE_ERROR = Symbol.for("llm-large-files.DocumentScopeError");
|
|
35
|
+
const INGEST_ERROR = Symbol.for("llm-large-files.IngestError");
|
|
36
|
+
/** The message of a `DocumentStoreError`, by what failed: words for a user, with no path and no host. */
|
|
37
|
+
function storeMessage(operation, code) {
|
|
38
|
+
if (code === "NEWER_VERSION")
|
|
39
|
+
return "The document was stored by a newer version of llm-large-files. Try again.";
|
|
40
|
+
const what = operation === "write" ? "The document could not be stored"
|
|
41
|
+
: operation === "delete" ? "The document could not be deleted"
|
|
42
|
+
: operation === "sweep" ? "The document store could not be cleaned up"
|
|
43
|
+
: "The document store could not be read";
|
|
44
|
+
// A code is shown only when it reads as one (EIO, ETIMEDOUT): a driver may put a host in `code`.
|
|
45
|
+
return `${what}${isErrorCode(code) ? ` (${code})` : ""}. Try again.`;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The store failed just now: a volume that did not answer, too many open files, a database that
|
|
49
|
+
* is down. It does not mean that the document is gone, and the same call may work a moment later,
|
|
50
|
+
* so retry it rather than ask the user to upload the file again.
|
|
13
51
|
*
|
|
14
52
|
* The message names no path and no host. The error that was caught is `cause`: log that one on
|
|
15
53
|
* the server, and show this one to a user or a model.
|
|
54
|
+
*
|
|
55
|
+
* New in 0.9.0: `operation` says what failed, `status` is 503, and code "NEWER_VERSION" is
|
|
56
|
+
* metadata written by a newer version of the package, which this one does not read. Before 0.9.0
|
|
57
|
+
* it was only made for reads, and `new DocumentStoreError(cause)` still makes one.
|
|
16
58
|
*/
|
|
17
59
|
export class DocumentStoreError extends Error {
|
|
18
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* The code of the system error behind it (`EIO`, `EMFILE`, `ETIMEDOUT`), when there is one, or
|
|
62
|
+
* the code it was made with: "NEWER_VERSION".
|
|
63
|
+
*/
|
|
19
64
|
code;
|
|
20
65
|
/** The system call that failed (`open`, `read`), when there is one. */
|
|
21
66
|
syscall;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
67
|
+
/** What the store was doing. "read" unless it was made with another. */
|
|
68
|
+
operation;
|
|
69
|
+
/** The HTTP status to answer with: the server cannot serve the request now. */
|
|
70
|
+
status = 503;
|
|
71
|
+
constructor(cause, options = {}) {
|
|
72
|
+
const found = systemError(cause);
|
|
73
|
+
const code = options.code ?? found.code;
|
|
74
|
+
const operation = options.operation ?? "read";
|
|
75
|
+
super(storeMessage(operation, code), { cause });
|
|
25
76
|
this.name = "DocumentStoreError";
|
|
77
|
+
this.operation = operation;
|
|
26
78
|
if (code)
|
|
27
79
|
this.code = code;
|
|
28
|
-
if (syscall)
|
|
29
|
-
this.syscall = syscall;
|
|
80
|
+
if (found.syscall)
|
|
81
|
+
this.syscall = found.syscall;
|
|
82
|
+
}
|
|
83
|
+
/** Whether `value` is a `DocumentStoreError`, made by this copy of the package or another one. New in 0.9.0. */
|
|
84
|
+
static is(value) {
|
|
85
|
+
return branded(value, DOCUMENT_STORE_ERROR);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
brand(DocumentStoreError, DOCUMENT_STORE_ERROR);
|
|
89
|
+
const SCOPE_MESSAGES = {
|
|
90
|
+
scope_invalid: "The scope is not valid.",
|
|
91
|
+
scope_required: "A scope is required: pass the scope of the document, such as [userId, chatId].",
|
|
92
|
+
scope_missing: "The scope no longer exists.",
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* A scope (`DocumentScope`) that cannot be used: one that is not valid, a call without one to a
|
|
96
|
+
* store that needs one, or a scope whose place in the store is gone. A mistake in the call, not a
|
|
97
|
+
* failure of the store: the library passes it on as it is, and retrying the same call fails again.
|
|
98
|
+
* The message names no segment of the scope. New in 0.9.0.
|
|
99
|
+
*/
|
|
100
|
+
export class DocumentScopeError extends TypeError {
|
|
101
|
+
code;
|
|
102
|
+
constructor(code, message = SCOPE_MESSAGES[code], options = {}) {
|
|
103
|
+
super(message, options.cause === undefined ? undefined : { cause: options.cause });
|
|
104
|
+
this.name = "DocumentScopeError";
|
|
105
|
+
this.code = code;
|
|
106
|
+
}
|
|
107
|
+
/** Whether `value` is a `DocumentScopeError`, made by this copy of the package or another one. */
|
|
108
|
+
static is(value) {
|
|
109
|
+
return branded(value, DOCUMENT_SCOPE_ERROR);
|
|
30
110
|
}
|
|
31
111
|
}
|
|
112
|
+
brand(DocumentScopeError, DOCUMENT_SCOPE_ERROR);
|
|
32
113
|
/**
|
|
33
114
|
* The errors a store threw while `ingest` wrote a document. `ingest` passes them on as they are,
|
|
34
115
|
* and the upload handler tells them apart from a file that could not be read: their message is
|
|
@@ -46,14 +127,15 @@ export function isStoreWriteFailure(error) {
|
|
|
46
127
|
}
|
|
47
128
|
/**
|
|
48
129
|
* What to tell a model, or a user, about an error: its message, unless it is a system error, whose
|
|
49
|
-
* message names a path or a host of the server. Of that one only the code is passed on
|
|
130
|
+
* message names a path or a host of the server. Of that one only the code is passed on, when it
|
|
131
|
+
* reads as one (`isErrorCode`).
|
|
50
132
|
*/
|
|
51
133
|
export function safeErrorMessage(error) {
|
|
52
|
-
if (error
|
|
134
|
+
if (DocumentStoreError.is(error))
|
|
53
135
|
return error.message;
|
|
54
136
|
const { code, syscall } = systemError(error);
|
|
55
137
|
if (code && syscall)
|
|
56
|
-
return `The file could not be read from storage (${code}). Try the call again.`;
|
|
138
|
+
return `The file could not be read from storage${isErrorCode(code) ? ` (${code})` : ""}. Try the call again.`;
|
|
57
139
|
return error instanceof Error ? error.message : String(error);
|
|
58
140
|
}
|
|
59
141
|
/**
|
|
@@ -64,17 +146,22 @@ export function safeErrorMessage(error) {
|
|
|
64
146
|
*/
|
|
65
147
|
export class IngestError extends Error {
|
|
66
148
|
code;
|
|
67
|
-
/** The HTTP status the upload handler answers with: 422 for a file that cannot be read, 413 for "too_large", 503 for "busy". */
|
|
149
|
+
/** The HTTP status the upload handler answers with: 422 for a file that cannot be read, 413 for "too_large", 409 for "exists", 503 for "busy". */
|
|
68
150
|
status;
|
|
69
151
|
constructor(code, message, options = {}) {
|
|
70
152
|
super(message, options.cause === undefined ? undefined : { cause: options.cause });
|
|
71
153
|
this.name = "IngestError";
|
|
72
154
|
this.code = code;
|
|
73
|
-
this.status = code === "busy" ? 503 : code === "too_large" ? 413 : 422;
|
|
155
|
+
this.status = code === "busy" ? 503 : code === "too_large" ? 413 : code === "exists" ? 409 : 422;
|
|
74
156
|
if (options.retryAfterMs !== undefined)
|
|
75
157
|
this.retryAfterMs = options.retryAfterMs;
|
|
76
158
|
}
|
|
159
|
+
/** Whether `value` is an `IngestError`, made by this copy of the package or another one. New in 0.9.0. */
|
|
160
|
+
static is(value) {
|
|
161
|
+
return branded(value, INGEST_ERROR);
|
|
162
|
+
}
|
|
77
163
|
}
|
|
164
|
+
brand(IngestError, INGEST_ERROR);
|
|
78
165
|
/** The refusals of the library, by the words of their messages: the extractors give plain `Error`s. */
|
|
79
166
|
const REFUSALS = [
|
|
80
167
|
// First, and to the end of the message: the busy refusal of a file starts with its name, which
|
|
@@ -113,7 +200,7 @@ export function ingestErrorCodeOf(message) {
|
|
|
113
200
|
* own that reads a file).
|
|
114
201
|
*/
|
|
115
202
|
export function toIngestError(error) {
|
|
116
|
-
if (error
|
|
203
|
+
if (IngestError.is(error) || !(error instanceof Error))
|
|
117
204
|
return error;
|
|
118
205
|
const { code, syscall } = systemError(error);
|
|
119
206
|
const { status, statusCode } = error;
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,SAAS,WAAW,CAAC,KAAc;IACjC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAA0C,CAAC;IACjF,OAAO;QACL,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,GAAG,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAElI,8FAA8F;AAC9F,SAAS,WAAW,CAAC,KAAc;IACjC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAA0C,CAAC;IACjF,OAAO;QACL,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,GAAG,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc,EAAE,GAAW;IACjD,IAAI,CAAC;QACH,OAAO,OAAO,KAAK,KAAK,QAAQ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