Skip to content

Commit 8eae33d

Browse files
author
SunriseFox
committed
[Fix] if onerror handler is not set, rethrow the error
1 parent 6903c99 commit 8eae33d

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ The IMAP client has several events you can attach to by setting a listener
677677
### Handling fatal error event
678678

679679
The invocation of `onerror` indicates an irrecoverable error. When `onerror` is fired, the connection is already closed, hence there's no need for further cleanup.
680+
If no `onerror` is specified, the error will be thrown.
680681

681682
## Get your hands dirty
682683

dist/client.js

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ export default class Client {
105105
clearTimeout(this._idleTimeout)
106106

107107
// propagate the error upwards
108-
this.onerror && this.onerror(err)
108+
if (this.onerror) {
109+
this.onerror(err)
110+
} else {
111+
throw err
112+
}
109113
}
110114

111115
//

0 commit comments

Comments
 (0)