Various error log improvements #100

Open
l1s5 wants to merge 6 commits from l1s5/out-of-your-element:log-improvements into main
Showing only changes of commit 8e9458d41c - Show all commits

Log failed m2d error reports

Whenever `sendError` fails (the function responsible for sending reports
about failed m2d bridging back to the matrix room), the error was
silently dropped. We now log it as an error to the console.
l1s5 2026-10-25 20:51:20 +09:00
Signed by untrusted user: l1s5
GPG key ID: D0A90CC905B58D9B

View file

@ -128,7 +128,14 @@ async function sendError(roomID, source, type, e, payload) {
|| (e instanceof mreq.MatrixServerError && [502, 503].includes(e.httpStatus) && e.errcode === "CX_SERVER_ERROR") || (e instanceof mreq.MatrixServerError && [502, 503].includes(e.httpStatus) && e.errcode === "CX_SERVER_ERROR")
) { ) {
// Matrix homeserver is down (reverse proxy indicated failure) // Matrix homeserver is down (reverse proxy indicated failure)
console.error([
`Matrix homeserver is down, queueing ${type} ${source} event.`,
`Couldn't send error report to ${roomID}:`,
util.inspect(e, false, 4, false),
].join("\n"))
homeserverStatus.homeserverStatus.setErrorWithPacket([source, payload]) homeserverStatus.homeserverStatus.setErrorWithPacket([source, payload])
} else {
console.error(`Couldn't send error report for a ${type} ${source} event to ${roomID}:\n${util.inspect(e, false, 4, false)}`)
} }
} }
} }