fix: proper parse Error message on Node 12 (#4698)
Check message prefix rather than strict equality when detecting circular JSON error. The message format has changed in Node 12 which broke the condition and failed a test.
This commit is contained in:
parent
49b27956fe
commit
715aad2d67
@ -67,7 +67,7 @@ class ExecutionContext {
|
||||
executionContextId: this._executionContextId
|
||||
});
|
||||
} catch (err) {
|
||||
if (err instanceof TypeError && err.message === 'Converting circular structure to JSON')
|
||||
if (err instanceof TypeError && err.message.startsWith('Converting circular structure to JSON'))
|
||||
err.message += ' Are you passing a nested JSHandle?';
|
||||
throw err;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ class ExecutionContext {
|
||||
userGesture: true
|
||||
});
|
||||
} catch (err) {
|
||||
if (err instanceof TypeError && err.message === 'Converting circular structure to JSON')
|
||||
if (err instanceof TypeError && err.message.startsWith('Converting circular structure to JSON'))
|
||||
err.message += ' Are you passing a nested JSHandle?';
|
||||
throw err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user