Skip to content

Commit c67d315

Browse files
committed
Include details if any in JSON requests
1 parent 58bd700 commit c67d315

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/common/http.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export enum HttpCode {
99
}
1010

1111
export class HttpError extends Error {
12-
public constructor(message: string, public readonly code: number) {
12+
public constructor(message: string, public readonly code: number, public readonly details?: object) {
1313
super(message)
1414
this.name = this.constructor.name
1515
}

src/node/http.ts

+2
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,10 @@ export class HttpServer {
667667
if (request.headers["content-type"] === "application/json") {
668668
write({
669669
code,
670+
mime: "application/json",
670671
content: {
671672
error: e.message,
673+
...(e.details || {}),
672674
},
673675
})
674676
} else {

0 commit comments

Comments
 (0)