You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/action-listener-middleware/README.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -100,6 +100,8 @@ Current options are:
100
100
101
101
-`extra`: an optional "extra argument" that will be injected into the `listenerApi` parameter of each listener. Equivalent to [the "extra argument" in the Redux Thunk middleware](https://redux.js.org/usage/writing-logic-thunks#injecting-config-values-into-thunks).
102
102
103
+
-`onError`: an optional error handler that gets called with synchronous errors raised by `listener` and `predicate`.
* Safely reports errors to the `errorHandler` provided.
143
+
* Errors that occur inside `errorHandler` are notified in a new task.
144
+
* Inspired by [rxjs reportUnhandledError](https://github.com/ReactiveX/rxjs/blob/6fafcf53dc9e557439b25debaeadfd224b245a66/src/internal/util/reportUnhandledError.ts)
145
+
* @param errorHandler
146
+
* @param errorToNotify
147
+
*/
148
+
constsafelyNotifyError=(
149
+
errorHandler: ListenerErrorHandler,
150
+
errorToNotify: unknown
151
+
): void=>{
152
+
try{
153
+
errorHandler(errorToNotify)
154
+
}catch(errorHandlerError){
155
+
// We cannot let an error raised here block the listener queue.
156
+
// The error raised here will be picked up by `window.onerror`, `process.on('error')` etc...
0 commit comments