Liking cljdoc? Tell your friends :D

wagoe.platform.core.http.problem-details

Exceptions to error responses, and the :type -> status table.

The name is historical: these were RFC 7807 bodies until BOU-586 made every JSON error the one shape of wagoe.platform.core.http.errors.

Exceptions to error responses, and the `:type` -> status table.

The name is historical: these were RFC 7807 bodies until BOU-586 made every
JSON error the one shape of `wagoe.platform.core.http.errors`.
raw docstring

bad-requestclj

400 validation-error with message and optional details.

400 `validation-error` with `message` and optional `details`.
sourceraw docstring

cli-context*clj

(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-body
sourceraw docstring

default-error-mappingsclj

Default 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.
sourceraw docstring

enrich-contextclj

(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
sourceraw docstring

exception->problem-bodyclj

(exception->problem-body ex correlation-id uri error-mappings)
(exception->problem-body ex correlation-id _uri error-mappings _context)

The error body for ex, in the framework's one shape (BOU-586):

{:error {:type "not-found" :message "..." :details {...} :correlation-id "..."}}

A typed 4xx carries its message — ex-data :message, else the exception's, else the mapping's title — and the rest of its ex-data as :details. A 5xx carries none of that: raw messages and ex-data go to the server log, never to the client. uri and context are accepted for the callers that pass them and are not sent: request context is for the log.

The error body for `ex`, in the framework's one shape (BOU-586):

  {:error {:type "not-found" :message "..." :details {...}
           :correlation-id "..."}}

A typed 4xx carries its message — ex-data `:message`, else the exception's,
else the mapping's title — and the rest of its ex-data as `:details`. A 5xx
carries none of that: raw messages and ex-data go to the server log, never
to the client. `uri` and `context` are accepted for the callers that pass
them and are not sent: request context is for the log.
sourceraw docstring

exception->problem-responseclj

(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)

Ring response for ex: its status, and the body of exception->problem-body.

Ring response for `ex`: its status, and the body of
`exception->problem-body`.
sourceraw docstring

exception-statusclj

(exception-status ex error-mappings)

The HTTP status and title for ex: its :type looked up in the default mappings merged with error-mappings. Untyped or unmapped is a 500.

The HTTP status and title for `ex`: its `:type` looked up in the default
mappings merged with `error-mappings`. Untyped or unmapped is a 500.
sourceraw docstring

forbiddenclj

403 with message and optional details.

403 with `message` and optional `details`.
sourceraw docstring

internal-server-errorclj

500 with message and optional details.

500 with `message` and optional `details`.
sourceraw docstring

not-foundclj

404 with message and optional details.

404 with `message` and optional `details`.
sourceraw docstring

problem-details->responseclj

(problem-details->response status body)

Ring response for an error body. The body is encoded here, because some callers answer outside the content negotiation.

Ring response for an error body. The body is encoded here, because some
callers answer outside the content negotiation.
sourceraw docstring

request->context*clj

(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-body
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