You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Express doesn't support async functions, so we have to pass along the
// error manually using next().
next(error);
This is good, because I can register an error handler in my Express app to display a branded "server error" page.
However, returnLastResortErrorResponse means that errors in the request handler aren't thrown, so that catch isn't triggered and the Express error handler isn't called.
I think it would be nice if the Remix Express adapter disabled returnLastResortErrorResponse, causing the error to be thrown from the request handler and passed on to Express instead. The default Express error handler does pretty much exactly the same thing as returnLastResortErrorResponse anyway, so even in apps without a custom error handler this would be a reasonable behaviour (i.e. it would not have to be configurable externally).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In the Remix Express adapter, there's a
catch
that forwards errors to the next middleware in the stack:remix/packages/remix-express/server.ts
Lines 59 to 61 in 58ac1e9
This is good, because I can register an error handler in my Express app to display a branded "server error" page.
However,
returnLastResortErrorResponse
means that errors in the request handler aren't thrown, so thatcatch
isn't triggered and the Express error handler isn't called.remix/packages/remix-server-runtime/server.ts
Lines 674 to 688 in 58ac1e9
I think it would be nice if the Remix Express adapter disabled
returnLastResortErrorResponse
, causing the error to be thrown from the request handler and passed on to Express instead. The default Express error handler does pretty much exactly the same thing asreturnLastResortErrorResponse
anyway, so even in apps without a custom error handler this would be a reasonable behaviour (i.e. it would not have to be configurable externally).Beta Was this translation helpful? Give feedback.
All reactions