Knowledgebase

Error Handling in Frontend Applications Print

  • frontenddevelopment, frontend, errors, guide, howto, solution, zillionkinghost, hosting
  • 0

When things fail.

WHAT WILL FAIL

Network requests External services Component rendering Anything depending on browser capabilities

WHAT AN ERROR BOUNDARY DOES

Catches a rendering error and displays a fallback, rather than the whole application disappearing.

WHERE TO PLACE THEM

Around sections that can fail independently.

WHY NOT ONLY AT THE TOP

A single boundary means any failure removes everything.

WHAT TO SHOW THE USER

What happened, in plain language What they can do A way to retry

WHAT NOT TO SHOW

Technical detail A blank screen Nothing at all

WHAT TO DO ABOUT REQUEST FAILURES

Distinguish between failures: not found, not permitted, server error, network unavailable.

WHY

Each warrants a different message.

WHAT TO HANDLE SPECIFICALLY

Being offline, which is common on mobile connections.

WHAT TO REPORT

Errors, to a collection service.

WHY

Otherwise you only learn about failures users bother to report, which is very few.

WHAT TO INCLUDE IN REPORTS

Enough context to reproduce, without personal data.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot