Skip to content

Commit

Permalink
redux: change error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tammo committed May 5, 2021
1 parent 103d5a9 commit 2ddf966
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/redux/chains/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { getBlock } from '../../requests/getBlock';
import { onNewNetworkResult, updateNonces } from '../tasks/actions';
import { setTxProofOfWork } from '../tasks/selectors';

// AccountChain related stuff
export function loadAccountChain() {
return async (dispatch: ThunkDispatch, getState: () => RootState) => {
const state = getState();
Expand All @@ -35,7 +34,6 @@ export function loadAccountChain() {
if (err.name === BlockchainNotFoundError.errorName) {
dispatch(addLoggedError(err));
} else {
// @todo - we must find a way to handle generic errors as well
throw err;
}
}
Expand Down Expand Up @@ -113,7 +111,11 @@ export function reloadIndexedChains() {
const chain = await fetchBlockchain(publicSig);
dispatch(updateChain(chain));
} catch (err) {
dispatch(addLoggedError(err));
if (err.name === BlockchainNotFoundError.errorName) {
dispatch(addLoggedError(err));
} else {
console.error(err);
}
}
});
};
Expand Down

0 comments on commit 2ddf966

Please sign in to comment.