Back to all reviewers

Handle errors explicitly

microsoft/playwright
Based on 2 comments
TSX

Always provide explicit error handling instead of allowing silent failures or blank screens. Any place where an error can occur but is not handled explicitly is a bug. When errors occur, communicate clearly to users what went wrong and suggest recovery actions when possible.

Error Handling TSX

Reviewer Prompt

Always provide explicit error handling instead of allowing silent failures or blank screens. Any place where an error can occur but is not handled explicitly is a bug. When errors occur, communicate clearly to users what went wrong and suggest recovery actions when possible.

Example of problematic silent failure:

{!!report && <TestCaseViewLoader report={report} tests={filteredTests.tests} />}

Better approach with explicit error handling:

{!!report ? 
  <TestCaseViewLoader report={report} tests={filteredTests.tests} /> :
  <div className='error'>Report data could not be found</div>}

Even better with recovery guidance:

{!!report ? 
  <TestCaseViewLoader report={report} tests={filteredTests.tests} /> :
  <div className='error'>
    Report data could not be found. Try refreshing the page or check your connection.
  </div>}

This principle ensures users understand when something has gone wrong rather than being left with confusing blank screens or unresponsive interfaces.

2
Comments Analyzed
TSX
Primary Language
Error Handling
Category

Source Discussions