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?