add error handling
This commit is contained in:
@@ -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);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user