try {
const user = await User.create({
username,
password: hash,
email,
});
return res.json({
status: 'success',
object: {
username: user.username,
email: user.email,
},
});
} catch (error2) {
return res.status(500).send('Username already in use');
}
I'm testing to make sure you can't add the same two usernames to the database, and you can't it throws an error, but the error isnt being caught and the client never gets any type of response from the server after it makes the request. does anyone know why this is happening?