MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / errorHandlerSaga

Function errorHandlerSaga

client/src/redux/error-saga.js:12–23  ·  view source on GitHub ↗
({ payload: error })

Source from the content-addressed store, hash-verified

10const errorActionSelector = action => isError(action.payload);
11
12function* errorHandlerSaga({ payload: error }) {
13 if (isHandledError(error)) {
14 const { type, message, redirectTo } = unwrapHandledError(error);
15 if (redirectTo) {
16 navigate(redirectTo);
17 }
18 yield put(createFlashMessage({ type, message }));
19 return;
20 }
21 reportClientSideError('Unhandled Error caught in error-saga', error);
22 yield put(createFlashMessage(reportedErrorMessage));
23}
24
25const errorSagas = [takeEvery(errorActionSelector, errorHandlerSaga)];
26

Callers

nothing calls this directly

Calls 5

isHandledErrorFunction · 0.90
unwrapHandledErrorFunction · 0.90
createFlashMessageFunction · 0.90
reportClientSideErrorFunction · 0.90
putFunction · 0.85

Tested by

no test coverage detected