Skip to content

Commit

Permalink
Use appropriate error message and status code for register route
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryoverload committed Oct 16, 2024
1 parent 3d64319 commit d7f5840
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/services/api/routes/v1/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,16 @@ router.post('/', async (request: express.Request, response: express.Response): P
await pnid.save({ session });

await session.commitTransaction();
} catch (error) {
} catch (error: any) {
LOG_ERROR('[POST] /v1/register: ' + error);
if (error.stack) console.error(error.stack)

await session.abortTransaction();

response.status(400).json({
response.status(500).json({
app: 'api',
status: 400,
error: 'Password must have combination of letters, numbers, and/or punctuation characters'
status: 500,
error: 'Internal server error'
});

return;
Expand Down

0 comments on commit d7f5840

Please sign in to comment.