Skip to content

Commit

Permalink
pass the status code when creating a new error
Browse files Browse the repository at this point in the history
  • Loading branch information
kchobantonov committed Jan 5, 2025
1 parent 4e0d80b commit 59918ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/routeGeneration/templates/hapi.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function RegisterRoutes(server: any) {
throw error;
}

const boomErr = boomify(error instanceof Error ? error : new Error(error.message));
const boomErr = boomify(error instanceof Error ? error : new Error(error.message), { statusCode: error.status || 500 });
boomErr.output.statusCode = error.status || 500;
boomErr.output.payload = {
name: error.name,
Expand Down Expand Up @@ -199,7 +199,7 @@ export function RegisterRoutes(server: any) {
throw error;
}

const boomErr = boomify(error instanceof Error ? error : new Error(error.message));
const boomErr = boomify(error instanceof Error ? error : new Error(error.message), { statusCode: error.status || 500 });
boomErr.output.statusCode = error.status || 401;
boomErr.output.payload = {
name: error.name,
Expand Down

0 comments on commit 59918ba

Please sign in to comment.