(fn, getSystem, {
logErrors = true
} = {})
| 473 | } |
| 474 | |
| 475 | function 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 | |
| 499 | function configureStore(rootReducer, initialState, getSystem) { |
| 500 | const store = createStoreWithMiddleware(rootReducer, initialState, getSystem) |
no test coverage detected
searching dependent graphs…