mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-05 07:07:41 +00:00
fix(common): add workaround for divergence of EventEmitter3 from node's version
Node's version has special behavior for events named 'error' - if no handler, it auto-throws. EventEmitter3 does not include this.
This commit is contained in:
parent
afe25eda24
commit
877cd9767d
1 changed files with 5 additions and 1 deletions
|
|
@ -323,7 +323,11 @@ export class Parser extends EventEmitter {
|
|||
} catch (error1) {
|
||||
err = error1;
|
||||
if (!(this.saxParser.errThrown || this.saxParser.ended)) {
|
||||
this.emit('error', err);
|
||||
if(this.listenerCount('error') > 0) {
|
||||
this.emit('error', err);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
return this.saxParser.errThrown = true;
|
||||
} else if (this.saxParser.ended) {
|
||||
throw err;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue