简体   繁体   中英

Redux Saga, error swallowing

I try to add a global error handler on my react app. That work perfecly but I have only one problem when I use saga and a fetch call. Below a simple example :

例

The error (in setModules) is swallowing (I think by the fetch promise) but I dont understand where and how to correct this behavior. Is this case, the error is never send to the error or unhandledrejection events and google devtool reports that error from the "getModules" function. I tried many changes (like using done instead of then and remove the catch) but no miracle.

You have a catch statement into another catch... Try putting the (error handling logic) try/catch statement in your getModules saga only et viola.

I highly recommend to manage error into the sagas only, not in your gateways functions, that way to avoid this issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM