Liking cljdoc? Tell your friends :D

wagoe.platform.shell.utils.error-handling

Error handling utilities for enhanced context preservation and structured error responses.

This namespace provides middleware and utilities for capturing rich error context across HTTP and CLI interfaces, enabling better debugging and observability.

Error handling utilities for enhanced context preservation and structured error responses.

This namespace provides middleware and utilities for capturing rich error context
across HTTP and CLI interfaces, enabling better debugging and observability.
raw docstring

format-cli-errorclj

(format-cli-error ex & {:keys [include-context] :or {include-context false}})

Format an exception for CLI display with context information.

Extracts error context from exception and formats it for CLI output, providing both user-friendly error messages and debug information.

Args: ex: Exception with optional error context in ex-data :include-context (boolean): Whether to show full context (default false)

Returns: Formatted error string for CLI display

Format an exception for CLI display with context information.

Extracts error context from exception and formats it for CLI output,
providing both user-friendly error messages and debug information.

Args:
  ex: Exception with optional error context in ex-data
  :include-context (boolean): Whether to show full context (default false)
  
Returns:
  Formatted error string for CLI display
sourceraw docstring

with-cli-error-contextclj

(with-cli-error-context context operation-fn)

Execute a CLI operation with enhanced error context.

Wraps CLI operations to capture and preserve error context for better debugging and error reporting. This is the CLI equivalent of HTTP error context middleware.

Args: context: CLI context map with keys: :command - CLI command being executed :user-id - Current user identifier :additional context as needed operation-fn: Function to execute

Returns: Result of operation-fn, or throws exception with enhanced context

Execute a CLI operation with enhanced error context.

Wraps CLI operations to capture and preserve error context for better
debugging and error reporting. This is the CLI equivalent of HTTP
error context middleware.

Args:
  context: CLI context map with keys:
    :command - CLI command being executed
    :user-id - Current user identifier
    :additional context as needed
  operation-fn: Function to execute
    
Returns:
  Result of operation-fn, or throws exception with enhanced context
sourceraw docstring

wrap-enhanced-exception-handlingclj

(wrap-enhanced-exception-handling handler)
(wrap-enhanced-exception-handling handler error-mappings)

Enhanced exception handling middleware with comprehensive context capture.

This is an alternative to the basic exception handling middleware that provides more comprehensive error context and can be used when maximum debugging information is needed.

Features:

  • Uses pre-captured error context from wrap-error-context
  • Comprehensive error logging with full context
  • Enhanced Problem Details responses
  • Request/response correlation tracking

Args: handler: Ring handler function error-mappings: Optional custom error type mappings

Returns: Ring middleware function

Enhanced exception handling middleware with comprehensive context capture.

This is an alternative to the basic exception handling middleware that
provides more comprehensive error context and can be used when maximum
debugging information is needed.

Features:
- Uses pre-captured error context from wrap-error-context
- Comprehensive error logging with full context
- Enhanced Problem Details responses
- Request/response correlation tracking

Args:
  handler: Ring handler function
  error-mappings: Optional custom error type mappings
  
Returns:
  Ring middleware function
sourceraw docstring

wrap-error-contextclj

(wrap-error-context handler)

Middleware to enhance request with error context information.

This middleware runs early in the stack to capture and preserve context that will be useful for error handling and debugging. It enriches the request with standardized error context information.

Context captured:

  • Request ID (generated if not present)
  • Trace ID (from headers)
  • User Agent
  • IP Address
  • Environment
  • Timestamp

Args: handler: Ring handler function

Returns: Ring middleware function that adds :error-context to request

Middleware to enhance request with error context information.

This middleware runs early in the stack to capture and preserve context
that will be useful for error handling and debugging. It enriches the
request with standardized error context information.

Context captured:
- Request ID (generated if not present)
- Trace ID (from headers)
- User Agent
- IP Address
- Environment
- Timestamp

Args:
  handler: Ring handler function
  
Returns:
  Ring middleware function that adds :error-context to request
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close