Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/naptha/tesseract.js.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalearica <admin@scribeocr.com>2022-09-20 05:44:03 +0300
committerGitHub <noreply@github.com>2022-09-20 05:44:03 +0300
commitd8b29522c4866fdcade5e09e9ab74edbe7b4aff9 (patch)
treee2f943a8048093a6feb69b7f46d4dd4a64b37ade
parentdd6c40b6818468f45cf006e844501e6afdb377b1 (diff)
Reject promise on init failure per #602 (#667)
-rw-r--r--src/worker-script/index.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/worker-script/index.js b/src/worker-script/index.js
index 1e2cfb6..7e65930 100644
--- a/src/worker-script/index.js
+++ b/src/worker-script/index.js
@@ -185,7 +185,10 @@ const initialize = ({
api.End();
}
api = new TessModule.TessBaseAPI();
- api.Init(null, langs, oem);
+ const status = api.Init(null, langs, oem);
+ if (status === -1) {
+ res.reject('initialization failed');
+ }
params = defaultParams;
setParameters({ payload: { params } });
res.progress({