Skip to content

Commit 0389074

Browse files
committed
refactor: Update response error json to use "message" instead "reason"
1 parent a19c914 commit 0389074

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/responses.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
export async function UnauthorizedException() {
22
return new Response(
33
JSON.stringify({
4-
reason: 'Unauthorized',
4+
message: 'Unauthorized',
55
}),
66
{
77
status: 401,
88
statusText: 'Unauthorized',
99
headers: {
1010
'Content-Type': 'application/json',
1111
},
12-
},
12+
}
1313
);
1414
}
1515

1616
export async function NotFoundException() {
1717
return new Response(
1818
JSON.stringify({
19-
reason: 'Not Found',
19+
message: 'Not Found',
2020
}),
2121
{
2222
status: 404,
2323
statusText: 'Bad Request',
2424
headers: {
2525
'Content-Type': 'application/json',
2626
},
27-
},
27+
}
2828
);
2929
}
3030

31-
export async function BadRequestException(reason: string) {
31+
export async function BadRequestException(message: string) {
3232
return new Response(
3333
JSON.stringify({
34-
reason,
34+
message,
3535
}),
3636
{
3737
status: 400,
3838
statusText: 'Bad Request',
3939
headers: {
4040
'Content-Type': 'application/json',
4141
},
42-
},
42+
}
4343
);
4444
}
4545

46-
export async function ServerException(reason: string) {
46+
export async function ServerException(message: string) {
4747
return new Response(
4848
JSON.stringify({
49-
reason,
49+
message,
5050
}),
5151
{
5252
status: 500,
5353
statusText: 'Internal Server Error',
5454
headers: {
5555
'Content-Type': 'application/json',
5656
},
57-
},
57+
}
5858
);
5959
}
6060

0 commit comments

Comments
 (0)