Skip to content

Commit

Permalink
Merge pull request #824 from FreeAndFair/fetch-exc
Browse files Browse the repository at this point in the history
Dispatch network fail actions for more failed fetches.
  • Loading branch information
ranweiler authored Oct 9, 2017
2 parents aaa0a93 + 1c09e18 commit f3d0ea2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 30 deletions.
12 changes: 2 additions & 10 deletions client/src/action/county/uploadBallotManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ async function importBallotManifest(body: any) {

action('IMPORT_BALLOT_MANIFEST_OK', data);
} catch (e) {
if (e.message === 'Failed to fetch') {
action('IMPORT_BALLOT_MANIFEST_NETWORK_FAIL');
}

action('INTERNAL_ERROR');
action('IMPORT_BALLOT_MANIFEST_NETWORK_FAIL');

throw e;
}
Expand Down Expand Up @@ -75,11 +71,7 @@ async function uploadBallotManifest(countyId: number, file: Blob, hash: string)

importBallotManifest(received);
} catch (e) {
if (e.message === 'Failed to fetch') {
action('UPLOAD_BALLOT_MANIFEST_NETWORK_FAIL');
}

action('INTERNAL_ERROR');
action('UPLOAD_BALLOT_MANIFEST_NETWORK_FAIL');

throw e;
}
Expand Down
12 changes: 2 additions & 10 deletions client/src/action/county/uploadCvrExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ async function importCvrExport(body: any) {

action('IMPORT_CVR_EXPORT_OK', data);
} catch (e) {
if (e.message === 'Failed to fetch') {
action('IMPORT_CVR_EXPORT_NETWORK_FAIL');
}

action('INTERNAL_ERROR');
action('IMPORT_CVR_EXPORT_NETWORK_FAIL');

throw e;
}
Expand Down Expand Up @@ -75,11 +71,7 @@ async function uploadCvrExport(countyId: number, file: Blob, hash: string) {

importCvrExport(received);
} catch (e) {
if (e.message === 'Failed to fetch') {
action('UPLOAD_CVR_EXPORT_NETWORK_FAIL');
}

action('INTERNAL_ERROR');
action('UPLOAD_CVR_EXPORT_NETWORK_FAIL');

throw e;
}
Expand Down
6 changes: 1 addition & 5 deletions client/src/action/createFetchAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ function createFetchAction(config: CreateFetchConfig) {

action(okType, data);
} catch (e) {
if (e.message === 'Failed to fetch') {
action(networkFailType);
}

action('INTERNAL_ERROR');
action(networkFailType);

throw e;
}
Expand Down
6 changes: 1 addition & 5 deletions client/src/action/createSubmitAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ function createSubmitAction(config: CreateSubmitConfig) {

action(okType, data);
} catch (e) {
if (e.message === 'Failed to fetch') {
action(networkFailType);
}

action('INTERNAL_ERROR');
action(networkFailType);

throw e;
}
Expand Down

0 comments on commit f3d0ea2

Please sign in to comment.