Skip to content

Commit

Permalink
Switch to not try/catch around updatePermissions.
Browse files Browse the repository at this point in the history
When that happens today, as happens reasonably often in #690, this swallows the error and makes it harder to debug.

There shouldn't be an error under normal flows I don't think, and if the permissions doc doesn't exist the snapshot will have an exists() false, and return undefined from data(), which is already handled.
  • Loading branch information
jkomoros committed Jun 23, 2024
1 parent 7dbe4c9 commit 523dbc3
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/actions/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,7 @@ export const updatePermissions = (uid : Uid) : ThunkSomeAction => async (dispatc
});
return;
}
let snapshot;
try {
snapshot = await getDoc(doc(db, PERMISSIONS_COLLECTION, uid));
} catch(err) {
dispatch({
type: UPDATE_USER_PERMISSIONS,
permissions: {},
});
return;
}
const snapshot = await getDoc(doc(db, PERMISSIONS_COLLECTION, uid));
dispatch({
type: UPDATE_USER_PERMISSIONS,
//If thesnapshot doesn't exist then data() will be undefined, so always
Expand Down

0 comments on commit 523dbc3

Please sign in to comment.