Skip to content

Commit

Permalink
Better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rrliang committed Apr 26, 2024
1 parent afb419d commit 362fcae
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/app/account/account-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ export default function AccountForm({ user }) {
if (error) throw error;
setStatus(true);
} catch (error) {
setError(true);
if (error.code == 23505) {
setError("The username \"" + username + "\" is already taken. Please try a different username.")
} else {
setError("Errored with code " + error.code + "... Please try again.")
}
} finally {
setLoading(false);
}
Expand All @@ -131,12 +135,6 @@ export default function AccountForm({ user }) {
return (
<Box>
<Flex color='white'>
{/* <Center w='100px' bg='green.500' size='300px'>
<Text>Box 1</Text>
</Center> */}
{/* <Square bg='blue.500' size='200px'>
<Text>Box 2</Text>
</Square> */}
<Box margin='9'>
<Card maxW='sm' margin=''>
<CardBody>
Expand Down Expand Up @@ -359,7 +357,7 @@ export default function AccountForm({ user }) {
<Box>
<AlertTitle>Error!</AlertTitle>
<AlertDescription>
Error updating the data... Please try again.
Error updating the data. {error}
</AlertDescription>
</Box>
<CloseButton
Expand Down

0 comments on commit 362fcae

Please sign in to comment.