Skip to content

Commit af1ef6c

Browse files
artizclaude
andcommitted
wasm demo: surface the real TableFormer load error
The load fallback swallowed the fetch error and reported a flat "not found", hiding whether it was a 404, an HTTP 503 throttle, or an out-of-memory on the 225 MB encoder. Keep and report the last error. Refs #157 Signed-off-by: artiz <artem.kustikov@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EY5KAiquN4YpVf2PXEQkVT
1 parent efff575 commit af1ef6c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

crates/docling-wasm/www/pipeline.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,17 @@ export function createOcr({ onStatus }) {
214214
// external data from the same base.
215215
let base = null;
216216
let model = null;
217+
let lastErr = null;
217218
for (const b of TF_DIRS) {
218219
try {
219220
model = await fetchProgress(b + name + ".onnx", `tableformer ${name}`);
220221
base = b;
221222
break;
222223
} catch (e) {
223-
/* try the next base */
224+
lastErr = e; // keep the real cause (HTTP status, out-of-memory, …)
224225
}
225226
}
226-
if (!model) throw new Error(`tableformer ${name}.onnx not found (local or HF)`);
227+
if (!model) throw new Error(`tableformer ${name}.onnx failed: ${(lastErr && lastErr.message) || lastErr}`);
227228
const opts = { executionProviders: ["wasm"], logSeverityLevel: 3 };
228229
if (external) {
229230
const data = await fetchProgress(base + name + ".onnx.data", `tableformer ${name} data`);

0 commit comments

Comments
 (0)