PerformanceArchitecture
Resilience Lab

Error Strategy Visualizer

Test how different fetching libraries and environments surface errors. Learn to differentiate between network failures and application exceptions.

Trigger Scenarios

Expert Tip

Next.js 15+ Server Actions and fetch calls should almost always be wrapped in try/catch or use high-level Error Boundaries to prevent full-page crashes.

Error Console Output

Console Idle

Click a scenario to observe how error metadata is surfaced and handled in the application layer.

Fetch vs. Axios: The Error Bridge

Understanding how your fetching layer propagates errors is critical for building a predictable UI. Axios throws by default, while Fetch silently succeeds unless the request itself fails.

Client Choice

Native Fetch API

Built-in
const res = await fetch(url);// Manual check required:if (!res.ok) throw Error(res.status);
  • Lightweight (0 additional bundle size)
  • Standard Web API
  • Requires manual response validation

Axios Library

Library
try { const res = await axios.get(url);} catch (error) { // Auto-throws on non-2xx statuses!}
  • Automatic JSON transformation
  • Built-in request/response interceptors
  • Throw-on-error behavior by default
FeatureFetchAxios
Default Failure TriggerOnly on Network Error (DNS/Timeout)Any status code outside 2xx (4xx, 5xx)
JSON ParsingManual step (await res.json())Automatic (data property)
Error MetadataRequires manual construction of Error objectsRich error objects with response/config details