fix: Improved websockets error handling (#3726)

* fix: Add websocket client error capturing
fix: Incorrect parsing of documentName will never be empty

* fix: Non-present documentId in collaboration route should trigger an error response

* fix: Close unhandled websocket requests
This commit is contained in:
Tom Moor
2022-07-03 09:00:59 +02:00
committed by GitHub
parent 8ebe4b27b1
commit 1f3a1d4b86
4 changed files with 87 additions and 16 deletions

View File

@@ -1,3 +1,4 @@
import { IncomingMessage } from "http";
import chalk from "chalk";
import { isEmpty } from "lodash";
import winston from "winston";
@@ -100,8 +101,14 @@ class Logger {
* @param message A description of the error
* @param error The error that occurred
* @param extra Arbitrary data to be logged that will appear in prod logs
* @param request An optional request object to attach to the error
*/
error(message: string, error: Error, extra?: Extra) {
error(
message: string,
error: Error,
extra?: Extra,
request?: IncomingMessage
) {
Metrics.increment("logger.error");
Tracing.setError(error);
@@ -113,6 +120,12 @@ class Logger {
scope.setExtra(key, extra[key]);
}
if (request) {
scope.addEventProcessor(function (event) {
return Sentry.Handlers.parseRequest(event, request);
});
}
Sentry.captureException(error);
});
}