feat(debug): add note about DEBUG=pw:api to errors (#2496)

This commit is contained in:
Dmitry Gozman 2020-06-08 11:41:09 -07:00 committed by GitHub
parent 4cac74f8c2
commit bb4e959d2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,7 @@ export class ProgressController {
return result;
} catch (e) {
this._aborted();
rewriteErrorMessage(e, e.message + formatLogRecording(this._logRecording, this._apiName));
rewriteErrorMessage(e, e.message + formatLogRecording(this._logRecording, this._apiName) + kLoggingNote);
clearTimeout(timer);
this._state = 'aborted';
this._logRecording = [];
@ -126,6 +126,8 @@ async function runCleanup(cleanup: () => any) {
}
}
const kLoggingNote = `\nNote: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.`;
function formatLogRecording(log: string[], name: string): string {
if (!log.length)
return '';