Skip to content

Commit

Permalink
Merge pull request #4190 from airqo-platform/hf-user-profiles
Browse files Browse the repository at this point in the history
check if the caught error is an instance of HttpError
  • Loading branch information
Baalmart authored Jan 11, 2025
2 parents c04a0e2 + 0a8612d commit 160977e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/auth-service/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,10 @@ UserSchema.statics = {
}
} catch (error) {
logger.error(`🐛🐛 Internal Server Error -- ${error.message}`);
next(
if (error instanceof HttpError) {
return next(error);
}
return next(
new HttpError(
"Internal Server Error",
httpStatus.INTERNAL_SERVER_ERROR,
Expand Down Expand Up @@ -997,7 +1000,10 @@ UserSchema.statics = {
}
} catch (error) {
logger.error(`🐛🐛 Internal Server Error -- ${error.message}`);
next(
if (error instanceof HttpError) {
return next(error);
}
return next(
new HttpError(
"Internal Server Error",
httpStatus.INTERNAL_SERVER_ERROR,
Expand Down Expand Up @@ -1039,6 +1045,9 @@ UserSchema.statics = {
);
} catch (error) {
logger.error(`🐛🐛 Internal Server Error -- ${error.message}`);
if (error instanceof HttpError) {
return next(error);
}
return next(
new HttpError(
"Internal Server Error",
Expand Down Expand Up @@ -1078,7 +1087,10 @@ UserSchema.statics = {
} catch (error) {
logObject("the models error", error);
logger.error(`🐛🐛 Internal Server Error -- ${error.message}`);
next(
if (error instanceof HttpError) {
return next(error);
}
return next(
new HttpError(
"Internal Server Error",
httpStatus.INTERNAL_SERVER_ERROR,
Expand Down

0 comments on commit 160977e

Please sign in to comment.