mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Do not stringify errors when logging them
Converting errors to string drops their stack trace, making it more difficult to debug their actual reason. We can instead pass the error objects as-is to console.warn/error, so that Firefox/Chrome devtools will show both the stack trace of the console.warn/error call, and the original stack trace of the error. This commit also enables the `unicorn/no-console-spaces` ESLint rule, which avoids accidental extra spaces when passing multiple parameters to `console.*` methods.
This commit is contained in:
parent
d448953166
commit
202b26487f
12 changed files with 21 additions and 20 deletions
|
@ -86,7 +86,7 @@ async function downloadManifestFiles(manifest) {
|
|||
try {
|
||||
await downloadFile(file, url);
|
||||
} catch (ex) {
|
||||
console.error(`Error during downloading of ${url}: ${ex}`);
|
||||
console.error(`Error during downloading of ${url}:`, ex);
|
||||
fs.writeFileSync(file, ""); // making it empty file
|
||||
fs.writeFileSync(`${file}.error`, ex);
|
||||
}
|
||||
|
|
|
@ -1192,7 +1192,7 @@ class Driver {
|
|||
resolve();
|
||||
})
|
||||
.catch(reason => {
|
||||
console.warn(`Driver._send failed (${url}): ${reason}`);
|
||||
console.warn(`Driver._send failed (${url}):`, reason);
|
||||
|
||||
this.inFlightRequests--;
|
||||
resolve();
|
||||
|
|
|
@ -18,7 +18,7 @@ const TestReporter = function (browser) {
|
|||
resolve();
|
||||
})
|
||||
.catch(reason => {
|
||||
console.warn(`TestReporter - send failed (${action}): ${reason}`);
|
||||
console.warn(`TestReporter - send failed (${action}):`, reason);
|
||||
resolve();
|
||||
|
||||
send(action, json);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue