Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

264
Vistas
How to get all local variables in Node.js when an uncaught exception happens?

Whenever my node.js script has an uncaught exception. I'd like to be able to dump all the local variables to the console implicitly so that I can have a snapshot of all the values the moment anything went wrong.

Right now I can do this with visual code by having a debugger running, but is this possible to do using just code?

If not, what would be the best way to invoke a debugger to attach to the node script and dump the variables when an exception occurs?

Currently the built in node.js debugger has the watch() method for getting the variable values on an exception, but it requires that you implicitly specify the variable before the exception occurs.

There is the chrome v8 debugger using --inspect argument and visiting chrome://inspect/ in chrome, but that would require automating chrome using the Chrome DevTools Protocol.

It also requires an instance of chrome to be running which is too resource intensive on a VPS that has the minimum specs.

What is the best way to dump the local variables to a log file when something goes wrong?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda