#error-handling

24 snippets tagged with #error-handling

typescriptbeginner

Async Error Handler Wrapper

Higher-order function that wraps async Express route handlers and forwards rejected promises to error middleware.

Best for: Express route error handling

#express#async
typescriptintermediate

Express Error Handling Middleware

Centralized error handling in Express with custom error classes, async wrapper, and structured responses.

Best for: API error standardization

#nodejs#express
typescriptintermediate

Retry with Exponential Backoff

Retry failed async operations with exponential backoff, jitter, and configurable retry conditions.

Best for: API call resilience

#nodejs#retry
typescriptintermediate

Error Boundary with Fallback UI

Class-based error boundary component that catches render errors and displays a customizable fallback UI.

Best for: Graceful error recovery

#error-boundary#error-handling
typescriptintermediate

React Error Boundary Component

Build a reusable error boundary with retry, fallback UI, and error reporting integration.

Best for: Preventing full-page crashes from component errors

#react#error-boundary
typescriptintermediate

Error Boundary with Fallback UI

Error boundary class component with customizable fallback UI, retry button, and error reporting.

Best for: Graceful error recovery

#error-boundary#error-handling
typescriptintermediate

Next.js Error Handling Patterns

Implement error.tsx, not-found.tsx, and global-error.tsx for comprehensive error handling.

Best for: Graceful error recovery in nested layouts

#nextjs#error-handling
typescriptintermediate

Error Handling with error.tsx and not-found.tsx

Handle errors gracefully with error.tsx boundaries and not-found.tsx pages in App Router.

Best for: error boundaries

#nextjs#error-handling
pythonintermediate

Retry Decorator with Exponential Backoff

Generic retry decorator with configurable attempts, exponential backoff, and exception filtering.

Best for: Network request resilience

#decorator#retry
pythonbeginner

Tenacity Retry with Backoff

Add robust retry logic with exponential backoff, jitter, and conditional retry using the tenacity library.

Best for: Flaky API calls

#retry#tenacity
pythonintermediate

Retry Logic for Data Pipelines

Configurable retry decorator with exponential backoff and jitter for resilient data pipeline tasks.

Best for: Resilient API calls in data pipelines

#retry#resilience
javaintermediate

Spring Boot Global Exception Handler

Centralized error handling with @ControllerAdvice for validation errors, 404s, and custom exceptions.

Best for: Consistent error responses across all endpoints

#spring-boot#error-handling
javaintermediate

Custom Exception Hierarchy

Design a clean exception hierarchy with custom exceptions, error codes, and exception mapping.

Best for: Consistent error handling across services

#java#exceptions
javaintermediate

Retry Mechanism with Exponential Backoff

Implement retries with exponential backoff, jitter, max attempts, and exception-specific handling.

Best for: Resilient API calls with transient failure handling

#java#retry
kotlinintermediate

Result Monad — Functional Error Handling

Handle errors functionally with Kotlin Result: map, recover, fold, and chaining fallible operations.

Best for: Type-safe error handling without exceptions

#kotlin#result
kotlinadvanced

Coroutine Exception Handling and Supervision

Handle errors in coroutines: CoroutineExceptionHandler, supervisorScope, try-catch, and error propagation.

Best for: Robust error handling in concurrent operations

#kotlin#coroutines
kotlinbeginner

Preconditions — require, check, and error

Validate inputs and state with Kotlin preconditions: require, check, error, and custom assertions.

Best for: Input validation at function boundaries

#kotlin#validation
kotlinadvanced

Functional Error Handling with Either

Use Either and Option for type-safe error handling: Railway-oriented programming without exceptions.

Best for: Type-safe error handling without exceptions

#kotlin#functional
kotlinadvanced

SupervisorJob and Error Isolation

Isolate coroutine failures with SupervisorJob: independent child coroutines, partial failure handling.

Best for: Independent failure isolation in microservices

#kotlin#coroutines
kotlinadvanced

Functional Error Handling with Either

Implement Either monad for type-safe error handling with map, flatMap, and fold operations.

Best for: Type-safe error handling without exceptions

#kotlin#functional
kotlinintermediate

Kotlin Result API Functional Error Handling

Use Kotlin's built-in Result type for functional error handling: runCatching, map, recover, and fold.

Best for: Functional error handling without try-catch

#kotlin#result
kotlinintermediate

Kotlin Error Handling Patterns

Comprehensive error handling: sealed result types, validated aggregation, and railway-oriented programming.

Best for: Form validation with error accumulation

#kotlin#error-handling
scalaintermediate

Option Either and Try Error Handling

Handle errors functionally with Option, Either, and Try: map, flatMap, recover, and for-comprehensions.

Best for: Null-safe programming with Option

#scala#option
scalabeginner

Exception Handling Patterns

Handle exceptions in Scala: try-catch-finally, Try monad, NonFatal, and custom exceptions.

Best for: Graceful error recovery

#scala#exceptions