vocdoni/vocdoni-sdk

bug: cannot access variable before declaration

elboletaire opened this issue · 0 comments

Describe the bug

services.fetchElection crashes due to a variable being accessed before its declaration

To Reproduce

See

const electionInfo = await ElectionAPI.info(this.url, electionId).catch((err) => {
err.electionId = electionInfo.electionId;
throw err;
});

As you can see, electionInfo is being accessed in the same declaration, thus causing a crash.

Current behavior

Crashes

Expected behavior

Does not crash 🤗