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

193
Vistas
JS error stack is skipping caller of generator

While writing a logger, accessing the name of functions is ideal. Unfortunately this is quite tricky with strict mode. I have resorted to passing log messages as errors such as :

log(new Error("Foobar")

and then slicing up the error.stack to suit. I have come across an issue where the helpful function name is skipped in the stack output.

// helpfulName.ts
export const helpfulName = ()=> wrapper(networkCallWithSimilarName())

// wrapper.ts
export async function* wrapper(generator){
log(new Error("Foobar")
return generator // I actually for of ... yield here
}

// index.ts

(async ()=>{
for await (const response of helpfulName()) {
...
})()

with the expected log output something like

at wrapper wrapper.ts(line)
at wrapper.next (<anonymous>)
at helpfulName helpfulName.ts(line)
at index.ts(line)

but instead helpfulName is missing

at wrapper wrapper.ts(line)
at wrapper.next (<anonymous>)
at index.ts(line)

I have tried various iterations of ES6/ES5 functions and different methods of exporting and wrapping in more functions, but I have been unable to get any reference to the helpfulName.ts from an error in wrapper(). Is this possible? Why is it not in the stack trace?

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