add error handling

This commit is contained in:
marlon-erler
2024-07-08 20:55:28 +02:00
parent 49b4ed94f6
commit 85164a4e0a
+13
View File
@@ -11,6 +11,7 @@ import {
import {
createFileResponse,
getVersionNumber,
writeError,
writeStatNumber,
writeStatString,
writeSuccess,
@@ -59,13 +60,25 @@ async function main() {
websocket: {
open(ws) {
try {
trackConnection(ws);
} catch (error) {
writeError(error);
}
},
message(ws, message) {
try {
processMessage(ws, message.toString(), config);
} catch (error) {
writeError(error);
}
},
close(ws) {
try {
forgetConnection(ws);
} catch (error) {
writeError(error);
}
},
},