From d8b29522c4866fdcade5e09e9ab74edbe7b4aff9 Mon Sep 17 00:00:00 2001 From: Balearica Date: Mon, 19 Sep 2022 19:44:03 -0700 Subject: [PATCH] Reject promise on init failure per #602 (#667) --- src/worker-script/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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({