Skip to content

Commit

Permalink
testing a fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
snevesbarros committed Mar 13, 2023
1 parent 28171bf commit a380ab2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/team.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports.findOne = (req, res) => {
Team.findById(teamId)
.then((team) => {
if (!team) {
throw new NotFoundError(teamId, `Team not found with id ${teamId}`);
throw new NotFoundError(`Team not found with id ${teamId}`);
}
res.status(200).send(team);
}).catch((err) => {
Expand Down
6 changes: 5 additions & 1 deletion app/exceptions/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ const handleError = (error, res) => {
res.status(statusCode).send({ message });
} else {
const message = error.message || 'Server Error';
res.status(500).send({ message });
if (!res.headersSent) {
res.status(500).send({ message });
} else {
console.log(`${message}, headersSent: ${res.headersSent}`);
}
}
};

Expand Down

0 comments on commit a380ab2

Please sign in to comment.