Skip to content

Commit b7fad87

Browse files
committed
Alert from frontend errors in critical paths
1 parent 46aeef0 commit b7fad87

14 files changed

Lines changed: 60 additions & 22 deletions

File tree

decidim-elections/app/packs/src/decidim/elections/admin/pending_action.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Client } from "@decidim/decidim-bulletin_board";
2+
import { reportingErrors } from "src/decidim/reporting_errors";
23

3-
$(() => {
4+
$(reportingErrors(() => {
45
const $form = $("form.step");
56
const $pendingAction = $form.find("#pending_action");
67
const bulletinBoardClient = new Client({
@@ -11,4 +12,4 @@ $(() => {
1112
bulletinBoardClient.waitForPendingMessageToBeProcessed(messageId).then(() => {
1213
$form.trigger("submit");
1314
});
14-
});
15+
}));

decidim-elections/app/packs/src/decidim/elections/admin/trustees_process.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import {
33
Election,
44
MessageParser
55
} from "@decidim/decidim-bulletin_board";
6+
import { reportingErrorsAsync } from "src/decidim/reporting_errors";
67

78
const WAIT_TIME_MS = 10 * 1_000;
89

9-
$(async () => {
10+
$(reportingErrorsAsync(async () => {
1011
const $trusteesProcess = $("#trustees_process");
1112
const $checkingTrustees = $trusteesProcess.find(".trustee");
1213
const electionUniqueId = $trusteesProcess.data("electionUniqueId");
@@ -122,4 +123,4 @@ $(async () => {
122123
};
123124

124125
await checkTrusteesActivity();
125-
});
126+
}));
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/* eslint-disable no-inline-comments */
22
/* eslint-disable line-comment-position */
33
// fetches Vote stats every 3 seconds
4+
import { reportingErrors } from "src/decidim/reporting_errors";
45

5-
$(() => {
6+
$(reportingErrors(() => {
67
const WAIT_TIME_MS = 3000; // 3s
78

89
setInterval(function() {
910
$("#vote-stats").load($("#vote-stats").data("refreshUrl"));
1011
}, WAIT_TIME_MS);
11-
})
12+
}))

decidim-elections/app/packs/src/decidim/elections/election_log.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* for an election for the election log.
44
*/
55
import { Client, MessageParser } from "@decidim/decidim-bulletin_board";
6+
import { reportingErrorsAsync } from "src/decidim/reporting_errors";
67

7-
$(async () => {
8+
$(reportingErrorsAsync(async () => {
89
// UI Elements
910
const $electionLog = $(".election-log");
1011
const $createElectionStep = $electionLog.find("#create-election-step");
@@ -158,4 +159,4 @@ $(async () => {
158159
$resultStep.find(".results-published").removeClass("hide");
159160
addChainedHash(resultsLogEntry, $resultStep);
160161
}
161-
});
162+
}));
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { reportingErrors } from "src/decidim/reporting_errors";
12

2-
$(() => {
3+
$(reportingErrors(async () => {
34
const $onboarding = $("#onboarding-modal");
45
$onboarding.foundation("open");
5-
});
6+
}));

decidim-elections/app/packs/src/decidim/elections/trustee/key_ceremony.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import {
77

88
import { TrusteeWrapperAdapter as DummyTrusteeWrapperAdapter } from "@decidim/voting_schemes-dummy";
99
import { TrusteeWrapperAdapter as ElectionGuardTrusteeWrapperAdapter } from "@decidim/voting_schemes-electionguard";
10+
import { reportingErrors } from "src/decidim/reporting_errors";
11+
1012

1113
/**
1214
* This file is responsible to generate election keys,
1315
* create a backup of keys for the trustee and
1416
* update the election bulletin board status
1517
*/
16-
$(() => {
18+
$(reportingErrors(() => {
1719
// UI Elements
1820
const $keyCeremony = $(".trustee-step");
1921
const $startButton = $keyCeremony.find(".start");
@@ -160,4 +162,4 @@ $(() => {
160162
$startButton.prop("disabled", false);
161163
}
162164
});
163-
});
165+
}));

decidim-elections/app/packs/src/decidim/elections/trustee/tally.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import {
77

88
import { TrusteeWrapperAdapter as DummyTrusteeWrapperAdapter } from "@decidim/voting_schemes-dummy";
99
import { TrusteeWrapperAdapter as ElectionGuardTrusteeWrapperAdapter } from "@decidim/voting_schemes-electionguard";
10+
import { reportingErrors } from "src/decidim/reporting_errors";
1011

11-
$(() => {
12+
$(reportingErrors(() => {
1213
// UI Elements
1314
const $tally = $(".trustee-step");
1415
const $startButton = $tally.find(".start");
@@ -137,4 +138,4 @@ $(() => {
137138
await bindComponentEvents();
138139
}
139140
});
140-
});
141+
}));

decidim-elections/app/packs/src/decidim/elections/trustee/trustee_zone.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint-disable require-jsdoc, no-alert, func-style */
22

33
import { IdentificationKeys } from "@decidim/decidim-bulletin_board";
4+
import { reportingErrors } from "src/decidim/reporting_errors";
45

5-
$(() => {
6+
$(reportingErrors(() => {
67
function identificationKeys() {
78
const $form = $(".trustee_zone form");
89
const $trusteeSlug = $("#trustee_slug", $form);
@@ -59,4 +60,4 @@ $(() => {
5960
$(document).ready(() => {
6061
identificationKeys();
6162
});
62-
});
63+
}));

decidim-elections/app/packs/src/decidim/elections/voter/casting-vote.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Client } from "@decidim/decidim-bulletin_board";
2+
import { reportingErrorsAsync } from "src/decidim/reporting_errors";
23

3-
$(async () => {
4+
$(reportingErrorsAsync(async () => {
45
const $castingVoteWrapper = $(".casting-vote-wrapper");
56

67
const bulletinBoardClient = new Client({
@@ -11,4 +12,4 @@ $(async () => {
1112
await bulletinBoardClient.waitForPendingMessageToBeProcessed(messageId);
1213

1314
$("form.update_vote_status").trigger("submit");
14-
});
15+
}));

decidim-elections/app/packs/src/decidim/elections/voter/new-vote.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/* eslint-disable no-console */
22
import VoteQuestionsComponent from "src/decidim/elections/voter/vote_questions.component";
3+
import { reportingErrorsAsync } from "src/decidim/reporting_errors";
34
// The voting component might come from set-preview.js or setup-vote.js, it depends if it's a preview
45
// so in the view template we load the component and attach it to window
56
const { setupVoteComponent } = window.Decidim;
67

7-
$(async () => {
8+
$(reportingErrorsAsync(async () => {
89
// UI Elements
910
const $voteWrapper = $(".vote-wrapper");
1011
const $ballotHash = $voteWrapper.find(".ballot-hash");
@@ -80,4 +81,4 @@ $(async () => {
8081
console.log("Something went wrong.");
8182
}
8283
});
83-
});
84+
}));

0 commit comments

Comments
 (0)