Pure functions for RFC 7807 Problem Details transformations.
All functions are pure data transformations from exceptions to standardized error response structures.
Pure functions for RFC 7807 Problem Details transformations. All functions are pure data transformations from exceptions to standardized error response structures.
(bad-request detail)(bad-request detail extensions)Create a 400 Bad Request problem details response.
Args: detail: Human-readable description of the error extensions: Optional map of extension members
Returns: Ring response map with RFC 7807 problem details
Create a 400 Bad Request problem details response. Args: detail: Human-readable description of the error extensions: Optional map of extension members Returns: Ring response map with RFC 7807 problem details
(cli-context* runtime-context)(cli-context* runtime-context additional-context)Create error context for CLI operations.
Pure function: builds context map for CLI error handling from explicit runtime inputs supplied by the shell.
Args: runtime-context: Optional map with explicit runtime values such as :timestamp, :environment, and :process-id additional-context: Optional map of additional context fields to merge
Returns: Context map suitable for exception->problem-body
Create error context for CLI operations.
Pure function: builds context map for CLI error handling from explicit
runtime inputs supplied by the shell.
Args:
runtime-context: Optional map with explicit runtime values such as
:timestamp, :environment, and :process-id
additional-context: Optional map of additional context fields to merge
Returns:
Context map suitable for exception->problem-bodyDefault mapping of exception types to HTTP status codes and titles.
Pure data structure: no side effects.
Default mapping of exception types to HTTP status codes and titles. Pure data structure: no side effects.
(enrich-context base-context additional-context)Enrich existing context with additional debugging information.
Pure function: merges additional context while preserving existing values.
Args: base-context: Existing context map additional-context: Additional context to merge
Returns: Merged context map with additional-context taking precedence
Enrich existing context with additional debugging information. Pure function: merges additional context while preserving existing values. Args: base-context: Existing context map additional-context: Additional context to merge Returns: Merged context map with additional-context taking precedence
(exception->problem-body ex correlation-id uri error-mappings)(exception->problem-body ex correlation-id uri error-mappings context)Transform exception to RFC 7807 problem details body with context preservation.
Pure function: extracts exception data and builds response structure with additional context for better debugging and observability.
Args: ex: Exception with ex-data containing :type, :errors, etc. correlation-id: Request correlation ID string uri: Request URI string error-mappings: Map of error types to [status title] pairs context: Optional context map with keys: :user-id - Current user identifier :tenant-id - Current tenant identifier :trace-id - Distributed tracing ID :request-id - Request identifier :user-agent - Client user agent :ip-address - Client IP address :timestamp - Error timestamp (ISO-8601) :environment - Environment name (dev/staging/prod)
Returns: Map with RFC 7807 problem details structure including extension members and preserved context for debugging
Transform exception to RFC 7807 problem details body with context preservation.
Pure function: extracts exception data and builds response structure with
additional context for better debugging and observability.
Args:
ex: Exception with ex-data containing :type, :errors, etc.
correlation-id: Request correlation ID string
uri: Request URI string
error-mappings: Map of error types to [status title] pairs
context: Optional context map with keys:
:user-id - Current user identifier
:tenant-id - Current tenant identifier
:trace-id - Distributed tracing ID
:request-id - Request identifier
:user-agent - Client user agent
:ip-address - Client IP address
:timestamp - Error timestamp (ISO-8601)
:environment - Environment name (dev/staging/prod)
Returns:
Map with RFC 7807 problem details structure including extension members
and preserved context for debugging(exception->problem-response ex correlation-id uri)(exception->problem-response ex correlation-id uri error-mappings)(exception->problem-response ex correlation-id uri error-mappings context)Transform exception to complete RFC 7807 problem response with context.
Pure function: convenience wrapper combining body and response creation with optional context preservation for enhanced debugging.
Args: ex: Exception to transform correlation-id: Request correlation ID uri: Request URI error-mappings: Optional custom error mappings context: Optional context map (see exception->problem-body for details)
Returns: Ring response map with RFC 7807 problem details and preserved context
Transform exception to complete RFC 7807 problem response with context. Pure function: convenience wrapper combining body and response creation with optional context preservation for enhanced debugging. Args: ex: Exception to transform correlation-id: Request correlation ID uri: Request URI error-mappings: Optional custom error mappings context: Optional context map (see exception->problem-body for details) Returns: Ring response map with RFC 7807 problem details and preserved context
(internal-server-error detail)(internal-server-error detail extensions)Create a 500 Internal Server Error problem details response.
Args: detail: Human-readable description of the error extensions: Optional map of extension members
Returns: Ring response map with RFC 7807 problem details
Create a 500 Internal Server Error problem details response. Args: detail: Human-readable description of the error extensions: Optional map of extension members Returns: Ring response map with RFC 7807 problem details
(not-found detail)(not-found detail extensions)Create a 404 Not Found problem details response.
Args: detail: Human-readable description of what was not found extensions: Optional map of extension members
Returns: Ring response map with RFC 7807 problem details
Create a 404 Not Found problem details response. Args: detail: Human-readable description of what was not found extensions: Optional map of extension members Returns: Ring response map with RFC 7807 problem details
(problem-details->response problem-body)Convert problem details body to Ring response map.
Pure function: wraps problem details in HTTP response structure.
Args: problem-body: RFC 7807 problem details map
Returns: Ring response map with appropriate headers
Convert problem details body to Ring response map. Pure function: wraps problem details in HTTP response structure. Args: problem-body: RFC 7807 problem details map Returns: Ring response map with appropriate headers
(request->context* request)(request->context* request runtime-context)Extract error context from Ring request map.
Pure function: extracts relevant context information from HTTP request and merges explicit runtime context supplied by the shell.
Args: request: Ring request map runtime-context: Optional map with explicit runtime values such as :timestamp and :environment
Returns: Context map suitable for exception->problem-body
Extract error context from Ring request map.
Pure function: extracts relevant context information from HTTP request
and merges explicit runtime context supplied by the shell.
Args:
request: Ring request map
runtime-context: Optional map with explicit runtime values such as
:timestamp and :environment
Returns:
Context map suitable for exception->problem-bodycljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |