Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

256
Visualizações
Bluebird async.js throws error

When I debug my application and set it to breakpoint on all exceptions, it stops at line 3 in bluebirds async.js (link)

{throw new Error(); } catch (e) {firstLineError = e;}

That line strikes me as a little odd.

What's the purpose of it?

Thank you

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I would assume that it is there to get the error object of the first line to have some info about file names, paths and line numbers because things like this can be used for that. But I would have to look at the source code. It certainly looks interesting.

This is used in src/debuggability.js in the setBounds() function:

  • https://github.com/petkaantonov/bluebird/blob/master/src/debuggability.js#L690

that is called in this string that contains JavaScript which is presumably evaled somewhere:

  • https://github.com/petkaantonov/bluebird/blob/master/tools/build.js#L44-L66

This string is stored in a variable called lastLineCode. It seems that this all sets some scope for debugging to make sure that what is debugged is between the first line and the last line of the relevant part of the Bluebird source code, e.g. when it is combined with other modules.

You can look at some of those commits for more context of how it was added:

  • https://github.com/petkaantonov/bluebird/commit/74ced5b578e0e2574e62
  • https://github.com/petkaantonov/bluebird/commit/8fb54c51a935193d5329
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda