Record failed URL in more error messages
This commit is contained in:
+1
-1
@@ -396,7 +396,7 @@ async function getMedia(mxc, init = {}) {
|
|||||||
...init
|
...init
|
||||||
})
|
})
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
throw await mreq.makeMatrixServerError(res, init)
|
throw await mreq.makeMatrixServerError(res, {...init, url})
|
||||||
}
|
}
|
||||||
if (init.method !== "HEAD") {
|
if (init.method !== "HEAD") {
|
||||||
assert(res.body)
|
assert(res.body)
|
||||||
|
|||||||
+2
-2
@@ -27,9 +27,9 @@ async function makeMatrixServerError(res, opts = {}) {
|
|||||||
if (res.headers.get("content-type") === "application/json") {
|
if (res.headers.get("content-type") === "application/json") {
|
||||||
return new MatrixServerError(await res.json(), opts)
|
return new MatrixServerError(await res.json(), opts)
|
||||||
} else if (res.headers.get("content-type")?.startsWith("text/")) {
|
} else if (res.headers.get("content-type")?.startsWith("text/")) {
|
||||||
return new MatrixServerError({errcode: "CX_SERVER_ERROR", error: `Server returned HTTP status ${res.status}`, message: await res.text()})
|
return new MatrixServerError({errcode: "CX_SERVER_ERROR", error: `Server returned HTTP status ${res.status}`, message: await res.text()}, opts)
|
||||||
} else {
|
} else {
|
||||||
return new MatrixServerError({errcode: "CX_SERVER_ERROR", error: `Server returned HTTP status ${res.status}`, content_type: res.headers.get("content-type")})
|
return new MatrixServerError({errcode: "CX_SERVER_ERROR", error: `Server returned HTTP status ${res.status}`, content_type: res.headers.get("content-type")}, opts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user