aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/mecab.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2019-11-11 02:28:00 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2019-11-23 17:50:46 +0200
commitf97877a2097c8b27b75099e489b93db255cb68be (patch)
tree3d92d4e2dc16a4bf06d3a044d207107491faeb48 /ext/bg/js/mecab.js
parentb336ab3a9a0a2ac9a569ae217b506ceeeab6fda0 (diff)
promise improvements
Diffstat (limited to 'ext/bg/js/mecab.js')
-rw-r--r--ext/bg/js/mecab.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/bg/js/mecab.js b/ext/bg/js/mecab.js
index 4c62c2b0..b9f2d0b3 100644
--- a/ext/bg/js/mecab.js
+++ b/ext/bg/js/mecab.js
@@ -58,12 +58,10 @@ class Mecab {
const sequence = this.sequence++;
this.listeners[sequence] = {
- callback: (data) => {
- resolve(data);
- },
+ callback: resolve,
timer: setTimeout(() => {
delete this.listeners[sequence];
- reject(`Mecab invoke timed out in ${Mecab.timeout} ms`);
+ reject(new Error(`Mecab invoke timed out in ${Mecab.timeout} ms`));
}, Mecab.timeout)
}