rusackas commented on code in PR #40868:
URL: https://github.com/apache/superset/pull/40868#discussion_r3376101843


##########
superset-websocket/src/index.ts:
##########
@@ -513,9 +524,21 @@ export const cleanChannel = (channel: string) => {
 // server startup
 
 if (startServer) {
+  // Last-resort handlers so an unhandled async error is recorded through the
+  // configured logger instead of printing a default trace (or, for an
+  // unhandled rejection, terminating the process on newer Node versions).

Review Comment:
   Good catch. Wrapped the reason in `util.inspect()` so a `Symbol` (or any 
other non-stringable value) can no longer throw inside the last-resort handler. 
Fixed in f2254b16be.



##########
superset-websocket/src/index.ts:
##########
@@ -513,9 +524,21 @@ export const cleanChannel = (channel: string) => {
 // server startup
 
 if (startServer) {
+  // Last-resort handlers so an unhandled async error is recorded through the
+  // configured logger instead of printing a default trace (or, for an
+  // unhandled rejection, terminating the process on newer Node versions).
+  process.on('unhandledRejection', (reason: unknown) => {
+    logger.error(`Unhandled promise rejection: ${reason}`);
+  });

Review Comment:
   Agreed. The handler now guards with `err instanceof Error` before 
dereferencing `stack`/`message`, falling back to `util.inspect()` for non-Error 
throws (including `null`), so the exception path can no longer crash itself. 
Fixed in f2254b16be.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to