mirror of
https://github.com/danog/code-server.git
synced 2024-11-27 04:45:52 +01:00
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
Block a user