web-sdk-pp-detection 0.1.0 → 0.1.1
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/README.md +10 -12
- package/dist/browser-global.js +125 -74
- package/dist/browser-global.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +125 -74
- package/dist/index.js.map +1 -1
- package/dist/inference.worker.js +4 -3
- package/dist/inference.worker.js.map +1 -1
- package/package.json +1 -1
package/dist/inference.worker.js
CHANGED
|
@@ -13649,14 +13649,15 @@ function now() {
|
|
|
13649
13649
|
function mapError(error, phase) {
|
|
13650
13650
|
if (error instanceof PPDetectionError) return error;
|
|
13651
13651
|
const message = error instanceof Error ? error.message : String(error);
|
|
13652
|
+
const details = { phase, causeMessage: message };
|
|
13652
13653
|
if (/abort|cancel/i.test(message))
|
|
13653
|
-
return new PPDetectionError("ABORTED", "\u63A8\u7406\u5DF2\u53D6\u6D88",
|
|
13654
|
+
return new PPDetectionError("ABORTED", "\u63A8\u7406\u5DF2\u53D6\u6D88", details, { cause: error });
|
|
13654
13655
|
if (/memory|out.of.memory|allocation/i.test(message))
|
|
13655
|
-
return new PPDetectionError("OUT_OF_MEMORY", "\u8FD0\u884C\u65F6\u5185\u5B58\u4E0D\u8DB3",
|
|
13656
|
+
return new PPDetectionError("OUT_OF_MEMORY", "\u8FD0\u884C\u65F6\u5185\u5B58\u4E0D\u8DB3", details, { cause: error });
|
|
13656
13657
|
return new PPDetectionError(
|
|
13657
13658
|
phase === "create" ? "SESSION_CREATE_FAILED" : "INFERENCE_FAILED",
|
|
13658
13659
|
phase === "create" ? "\u521B\u5EFA ONNX Runtime \u4F1A\u8BDD\u5931\u8D25" : "ONNX Runtime \u63A8\u7406\u5931\u8D25",
|
|
13659
|
-
|
|
13660
|
+
details,
|
|
13660
13661
|
{ cause: error }
|
|
13661
13662
|
);
|
|
13662
13663
|
}
|