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

388
Vistas
Is there a way just replace with custom error each async error message without try catch each function?

let say launch method if executable not found it will throw, the error throw with string type. why it not object { message: 'Error failed', additionalInfo: 'trouble', executablePath: 'c:/' }. it happen to almost puppeteer method. so i need to replace it.

Error: Failed to launch the browser process! spawn H:/WebGame/GoogleChrome/chromess.exe ENOENT TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

instead, below ways.

class CustomError extends Error {
    constructor(executablePath) {
    super()
     this.message = 'Error: Failed to launch the browser process!';
     this.executablePath = executablePath;
  }
}

class Application {
  constructor() {
    this.browser;
  }
  async launch(options) {
    try {
      this.browser = await puppeteer.launch();
      return this.browser
    } catch(e) { throw new CustomError(options.executablePath) }
  }

  async close() await this.browser.close()
}

theres simply to just replace the error?

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