question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Timeout Error

See original GitHub issue

I just tried this piece of code:

const playwright = require('playwright');
try {
  await page.waitForSelector('.foo');
} catch (e) {
  if (e instanceof playwright.errors.TimeoutError) {
    // Do something if this is a timeout.
  }
  } else {
    console.log(err);
  }
}

I am running this with Jest however, so unsure if this affects it, but for me it ends up in the else branch. I assume that is not supposed to happen.

This does work:

if (err.name === 'TimeoutError')

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
dgozmancommented, Apr 30, 2020

I think the issue could be with TimeoutError class being a different instance in the test (executed in vm script) vs jest-playwright environment (executed in top-level Node context). We had a similar issue with instanceof RegExp.

1reaction
pavelfeldmancommented, Apr 30, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Timeout error code problem in one C++ question - CodeProject
This error message is typical from challenges sites, it simply means that you code takes too much time to execute. You simply forgot...
Read more >
Timeout error when generating data in SQL Server 2014
We keep getting a timeout error when generating data in SQL Server 2014. We have tried changing the timeout settings but it doesn't...
Read more >
how to solve timeout error for this code in hackerrank
Timeout error appears to be related to the scanf. If you look at the man page, scanf takes input from standard in.
Read more >
"Terminated due to timeout" status - HackerRank Support Center
To overcome and avoid the error, refer to the HackerRank Coding Environment Specifications Page, to know the specific memory and time limit for ......
Read more >
Timeout Error Diagnosis - FairCom
Timeout Error Diagnosis · Consider using the blocking lock timeout feature. · The client binary can be modified to produce a server stack...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found