MCPcopy
hub / github.com/swagger-api/swagger-ui / wrapWithTryCatch

Function wrapWithTryCatch

src/core/system.js:475–497  ·  view source on GitHub ↗
(fn, getSystem, {
  logErrors = true
} = {})

Source from the content-addressed store, hash-verified

473}
474
475function wrapWithTryCatch(fn, getSystem, {
476 logErrors = true
477} = {}) {
478 if(typeof fn !== "function") {
479 return fn
480 }
481
482 return function(...args) {
483 try {
484 return fn.call(this, ...args)
485 } catch(error) {
486 if(logErrors) {
487 const { uncaughtExceptionHandler} = getSystem().getConfigs()
488 if (typeof uncaughtExceptionHandler === "function") {
489 uncaughtExceptionHandler(error)
490 } else {
491 console.error(error)
492 }
493 }
494 return null
495 }
496 }
497}
498
499function configureStore(rootReducer, initialState, getSystem) {
500 const store = createStoreWithMiddleware(rootReducer, initialState, getSystem)

Callers 4

getBoundSelectorsMethod · 0.85
callAfterLoadFunction · 0.85
makeReducerFunction · 0.85

Calls 2

getConfigsMethod · 0.80
getSystemFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…