Skip to content

Commit

Permalink
Added raw data to fetchElection when function throws error
Browse files Browse the repository at this point in the history
  • Loading branch information
marcvelmer committed Jul 4, 2024
1 parent 2a0ec87 commit 9535df4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/services/election.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,16 @@ export class ElectionService extends Service implements ElectionServicePropertie
throw err;
});

const electionInfo = this.decryptMetadata(electionInformation, password);
let electionInfo, censusInfo;
try {
electionInfo = this.decryptMetadata(electionInformation, password);
censusInfo = await this.buildCensus(electionInfo);
} catch (e) {
e.electionId = electionId;
e.raw = electionInformation;
console.log(e);
throw e;
}

const electionParameters = {
id: electionInfo.electionId,
Expand All @@ -166,7 +175,7 @@ export class ElectionService extends Service implements ElectionServicePropertie
meta: electionInfo.metadata?.meta,
startDate: electionInfo.startDate,
endDate: electionInfo.endDate,
census: await this.buildCensus(electionInfo),
census: censusInfo,
maxCensusSize: electionInfo.census.maxCensusSize,
manuallyEnded: electionInfo.manuallyEnded,
fromArchive: electionInfo.fromArchive,
Expand Down

0 comments on commit 9535df4

Please sign in to comment.