kopia lustrzana https://gitlab.com/rysiekpl/libresilient
exceptions thrown in plugins are now properly caught in libresilientFetch (ref. #36)
rodzic
81dfaab7c5
commit
0932bf9b9f
|
@ -1026,6 +1026,10 @@ let initFromRequest = (req) => {
|
|||
* reqInfo - instance of LibResilientResourceInfo
|
||||
*/
|
||||
let libresilientFetch = (plugin, url, init, reqInfo) => {
|
||||
// we really need to catch any exceptions here
|
||||
// otherwise other plugins will not run!
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch#gotchas_when_throwing_errors
|
||||
try {
|
||||
// status of the plugin
|
||||
reqInfo.update({
|
||||
method: (plugin && "name" in plugin) ? plugin.name : "unknown",
|
||||
|
@ -1068,6 +1072,9 @@ let libresilientFetch = (plugin, url, init, reqInfo) => {
|
|||
fetch_promise,
|
||||
timeout_promise
|
||||
]);
|
||||
} catch(e) {
|
||||
return Promise.reject(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue