Skip to content

Commit 9dbdb1a

Browse files
committed
#1250: Readded try catches for reverted files without toasting error message
1 parent f17e728 commit 9dbdb1a

3 files changed

Lines changed: 33 additions & 18 deletions

File tree

src/frontend/src/components/CheckList.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ const CheckList: React.FC<CheckListProps> = ({ title, items, isDisabled }) => {
4141
};
4242

4343
const handleCheck = async (idx: number) => {
44-
await mutateAsync({ userId: auth.user!.userId, descriptionId: items[idx].id });
44+
try {
45+
await mutateAsync({ userId: auth.user!.userId, descriptionId: items[idx].id });
46+
} catch (e) {
47+
// do nothing; toasting error message will cause errors
48+
}
4549
};
4650

4751
items.sort((a: CheckListItem, b: CheckListItem) => {

src/frontend/src/hooks/auth.hooks.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,24 @@ export const useProvideAuth = () => {
1616
const [user, setUser] = useState<AuthenticatedUser | undefined>(undefined);
1717

1818
const devSignin = async (userId: number) => {
19-
const user = await mutateAsyncDev(userId);
20-
setUser(user);
21-
localStorage.setItem('devUserId', userId.toString());
22-
return user;
19+
try {
20+
const user = await mutateAsyncDev(userId);
21+
setUser(user);
22+
localStorage.setItem('devUserId', userId.toString());
23+
return user;
24+
} catch (e) {
25+
// do nothing; toasting error message will cause errors
26+
}
2327
};
2428

2529
const signin = async (id_token: string) => {
26-
const user = await mutateAsync(id_token);
27-
setUser(user);
28-
return user;
30+
try {
31+
const user = await mutateAsync(id_token);
32+
setUser(user);
33+
return user;
34+
} catch (e) {
35+
// do nothing; toasting error message will cause errors
36+
}
2937
};
3038

3139
const signout = () => {

src/frontend/src/pages/ChangeRequestDetailPage/ProposedSolutionsList.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,19 @@ const ProposedSolutionsList: React.FC<ProposedSolutionsListProps> = ({ proposedS
3333
const addProposedSolution = async (data: ProposedSolution) => {
3434
setShowEditableForm(false);
3535
const { description, timelineImpact, scopeImpact, budgetImpact } = data;
36-
37-
// send the details of new proposed solution to the backend database
38-
await mutateAsync({
39-
submitterId: userId,
40-
crId,
41-
description,
42-
scopeImpact,
43-
timelineImpact,
44-
budgetImpact
45-
});
36+
try {
37+
// send the details of new proposed solution to the backend database
38+
await mutateAsync({
39+
submitterId: userId,
40+
crId,
41+
description,
42+
scopeImpact,
43+
timelineImpact,
44+
budgetImpact
45+
});
46+
} catch (e) {
47+
// do nothing; toasting error message will cause errors
48+
}
4649
};
4750

4851
return (

0 commit comments

Comments
 (0)