Skip to content

Commit e1831a9

Browse files
authored
Merge pull request #2877 from IntersectMBO/fix/2680-cannot-communicate-with-ledger-cardano-app-due-to-devicestatuserror
fix(#2680): remove redundant sentry reports an handled wallet exceptions
2 parents c053055 + a132b76 commit e1831a9

File tree

4 files changed

+28
-55
lines changed

4 files changed

+28
-55
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ changes.
2626

2727
### Removed
2828

29-
-
29+
- Remove redundant sentry reports on handled wallet exceptions [Issue 2680](https://github.com/IntersectMBO/govtool/issues/2680)
3030

3131
## [v2.0.10](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.10) 2025-01-29
3232

govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Dispatch, SetStateAction, useCallback, useState } from "react";
22
import { useNavigate } from "react-router-dom";
33
import { useFormContext } from "react-hook-form";
44
import { blake2bHex } from "blakejs";
5-
import * as Sentry from "@sentry/react";
65
import { useTranslation } from "react-i18next";
76
import { NodeObject } from "jsonld";
87

@@ -129,36 +128,31 @@ export const useCreateGovernanceActionForm = (
129128
hash,
130129
url: data.storingURL,
131130
};
132-
try {
133-
switch (govActionType) {
134-
case GovernanceActionType.InfoAction:
135-
return await buildNewInfoGovernanceAction(commonGovActionDetails);
136-
case GovernanceActionType.TreasuryWithdrawals: {
137-
if (
138-
data.amount === undefined ||
139-
data.receivingAddress === undefined
140-
) {
141-
throw new Error(t("errors.invalidTreasuryGovernanceActionType"));
142-
}
131+
switch (govActionType) {
132+
case GovernanceActionType.InfoAction:
133+
return buildNewInfoGovernanceAction(commonGovActionDetails);
134+
case GovernanceActionType.TreasuryWithdrawals: {
135+
if (
136+
data.amount === undefined ||
137+
data.receivingAddress === undefined
138+
) {
139+
throw new Error(t("errors.invalidTreasuryGovernanceActionType"));
140+
}
143141

144-
const treasuryActionDetails = {
145-
...commonGovActionDetails,
146-
withdrawals: [
147-
{
148-
amount: data.amount,
149-
receivingAddress: data.receivingAddress,
150-
},
151-
],
152-
};
142+
const treasuryActionDetails = {
143+
...commonGovActionDetails,
144+
withdrawals: [
145+
{
146+
amount: data.amount,
147+
receivingAddress: data.receivingAddress,
148+
},
149+
],
150+
};
153151

154-
return await buildTreasuryGovernanceAction(treasuryActionDetails);
155-
}
156-
default:
157-
throw new Error(t("errors.invalidGovernanceActionType"));
152+
return buildTreasuryGovernanceAction(treasuryActionDetails);
158153
}
159-
} catch (error) {
160-
Sentry.setTag("hook", "useCreateGovernanceActionForm");
161-
Sentry.captureException(error);
154+
default:
155+
throw new Error(t("errors.invalidGovernanceActionType"));
162156
}
163157
},
164158
[hash],
@@ -249,8 +243,6 @@ export const useCreateGovernanceActionForm = (
249243
: undefined,
250244
dataTestId: "create-governance-action-error-modal",
251245
});
252-
Sentry.setTag("hook", "useCreateGovernanceActionForm");
253-
Sentry.captureException(error);
254246
}
255247
} finally {
256248
setIsLoading(false);

govtool/frontend/src/hooks/forms/useEditDRepInfoForm.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useNavigate } from "react-router-dom";
33
import { useTranslation } from "react-i18next";
44
import { useFormContext } from "react-hook-form";
55
import { blake2bHex } from "blakejs";
6-
import * as Sentry from "@sentry/react";
76
import { NodeObject } from "jsonld";
87

98
import { DREP_CONTEXT, PATHS, storageInformationErrorModals } from "@consts";
@@ -172,9 +171,6 @@ export const useEditDRepInfoForm = (
172171
},
173172
});
174173
} else {
175-
Sentry.setTag("hook", "useEditDRepInfoForm");
176-
Sentry.captureException(error);
177-
178174
openWalletErrorModal({
179175
error: error?.message ? error.message : JSON.stringify(error),
180176
onSumbit: () => backToDashboard(),

govtool/frontend/src/hooks/forms/useVoteContextForm.tsx

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Dispatch, SetStateAction, useCallback, useState } from "react";
22
import { useFormContext } from "react-hook-form";
33
import { blake2bHex } from "blakejs";
4-
import * as Sentry from "@sentry/react";
54
import { NodeObject } from "jsonld";
65

76
import { downloadJson, generateJsonld, generateMetadataBody } from "@utils";
@@ -60,16 +59,16 @@ export const useVoteContextForm = (
6059
downloadJson(json, "Vote_Context");
6160
};
6261

63-
const validateHash = useCallback(
64-
async (url: string, localHash: string | null) => {
62+
const onSubmit = useCallback(
63+
async (data: VoteContextFormValues) => {
6564
try {
66-
if (!localHash) {
65+
if (!hash) {
6766
throw new Error(MetadataValidationStatus.INVALID_HASH);
6867
}
6968

7069
const result = await validateMetadata({
71-
hash: localHash,
72-
url,
70+
hash,
71+
url: data.storingURL,
7372
});
7473

7574
if (result.status) {
@@ -82,20 +81,6 @@ export const useVoteContextForm = (
8281
if (setErrorMessage) setErrorMessage(error);
8382
if (setStep) setStep(4);
8483
}
85-
throw error;
86-
}
87-
},
88-
[],
89-
);
90-
91-
const onSubmit = useCallback(
92-
async (data: VoteContextFormValues) => {
93-
try {
94-
await validateHash(data.storingURL, hash);
95-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
96-
} catch (error: any) {
97-
Sentry.setTag("hook", "useVoteContextForm");
98-
Sentry.captureException(error);
9984
} finally {
10085
if (setSavedHash) setSavedHash(hash);
10186
if (setStep) setStep(4);

0 commit comments

Comments
 (0)