Skip to content

Commit

Permalink
Merge pull request #273 from hmcts/bug/EUI-902-error-handling-users
Browse files Browse the repository at this point in the history
EUI-902 changed error handling
  • Loading branch information
adnanakgun authored Oct 9, 2019
2 parents 659afc6 + fc606da commit e429524
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/userList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ async function handleUserListRoute(req, res) {
logger.info('response::', response.data)
res.send(response.data)
} catch (error) {
const errReport = JSON.stringify({
apiError: error,
const errReport = {
apiError: error.data && error.data.message ? error.data.message : error,
apiStatusCode: error.statusCode,
message: 'List of users route error',
})
res.send(errReport).status(500)
}
res.status(500).send(errReport)
}
}

Expand Down

0 comments on commit e429524

Please sign in to comment.