forked from MapComplete/MapComplete
Fix error reporting service
This commit is contained in:
parent
1e4e672e72
commit
0a5be146ff
1 changed files with 5 additions and 5 deletions
|
@ -24,7 +24,7 @@ class ServerErrorReport extends Script {
|
||||||
".lines.json"
|
".lines.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
public reportError(path: string, queryParams: URLSearchParams, req: IncomingMessage, body: string | undefined, logDirectory: string) {
|
public reportError(path: string, queryParams: URLSearchParams, req: IncomingMessage, body: string | undefined, logDirectory: string): string {
|
||||||
if (!body) {
|
if (!body) {
|
||||||
throw "{\"error\": \"No body; use a post request\"}"
|
throw "{\"error\": \"No body; use a post request\"}"
|
||||||
}
|
}
|
||||||
|
@ -83,15 +83,15 @@ class ServerErrorReport extends Script {
|
||||||
{
|
{
|
||||||
mustMatch: "report",
|
mustMatch: "report",
|
||||||
mimetype: "application/json",
|
mimetype: "application/json",
|
||||||
handle(path: string, queryParams: URLSearchParams, req: IncomingMessage, body: string | undefined) {
|
handle: async (path: string, queryParams: URLSearchParams, req: IncomingMessage, body: string | undefined) => {
|
||||||
return this.reportError(queryParams, req, body, logDirectory)
|
return this.reportError(path, queryParams, req, body, logDirectory)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
mustMatch: "csp",
|
mustMatch: "csp",
|
||||||
mimetype: "application/json",
|
mimetype: "application/json",
|
||||||
handle(path: string, queryParams: URLSearchParams, req: IncomingMessage, body: string | undefined) {
|
handle: async (path: string, queryParams: URLSearchParams, req: IncomingMessage, body: string | undefined) => {
|
||||||
return this.reportError(queryParams, req, body, logDirectory+"/csp")
|
return this.reportError(path, queryParams, req, body, logDirectory+"/csp")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue