2

I am trying to catch an error in Oak for the purpose of logging. How do I catch an error with the "app.listen" method? I attempted to use try/catch but it seems like Deno catches the error before I can.

try{
  app.listen({port: 
  3000});
  logger.info('Listening...');
 }catch(e){
   handleTheError(e);
 }
Hayden
  • 779
  • 10
  • 18
  • The `listen` method should never throw — error handling should take place directly in your middleware functions ([see the docs](https://github.com/oakserver/oak/tree/v12.5.0#error-handling)). Does this answer your question? If so, I can write it up as one — if not, what am I missing? – jsejcksn Jun 26 '23 at 03:26
  • I believe this is a bug in Deno: https://github.com/denoland/deno/issues/20186 – diachedelic Aug 17 '23 at 05:27

0 Answers0