Skip to content

Commit

Permalink
changes to error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash Gupta authored and Yash Gupta committed Oct 28, 2023
1 parent 1db78e4 commit da1496e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server/mongodb/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ async function createRootUser() {
return user;
} catch(error) {
if (error.code === 11000) {
throw new Error("Duplicate email")
return {
error: "Duplicate email"
}
} else {
throw new Error("Error is" + error.message)
return {
error: "Error is" + error.message
}
}
}

Expand Down

0 comments on commit da1496e

Please sign in to comment.