mirror of https://git.tuxpa.in/a/code-server.git
Include details if any in JSON requests
This commit is contained in:
parent
58bd7008b4
commit
c67d31580f
|
@ -9,7 +9,7 @@ export enum HttpCode {
|
|||
}
|
||||
|
||||
export class HttpError extends Error {
|
||||
public constructor(message: string, public readonly code: number) {
|
||||
public constructor(message: string, public readonly code: number, public readonly details?: object) {
|
||||
super(message)
|
||||
this.name = this.constructor.name
|
||||
}
|
||||
|
|
|
@ -667,8 +667,10 @@ export class HttpServer {
|
|||
if (request.headers["content-type"] === "application/json") {
|
||||
write({
|
||||
code,
|
||||
mime: "application/json",
|
||||
content: {
|
||||
error: e.message,
|
||||
...(e.details || {}),
|
||||
},
|
||||
})
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue