amelinium.errors

added in 1.0.0

amelinium service, error handling.

config

(config config-src)

Returns ErrorsConfig record extracted from configuration source config-src.

config?

(config? v)

Returns true if the given object is an instance of ErrorsConfig.

configurable?

(configurable? v)

default-response

(default-response config-src)

Returns the default error response rendering function. Returns nil when config-src is nil.

init-errors

(init-errors config)

Initializes errors configuration. Returns ErrorsConfig record.

most-significant

(most-significant config-src errors)

Returns the most significant error from the given errors using the given config (which may be of type ErrorsConfig, a request map, or a Match object). If errors is not a sequence but an identifier, it is returned as-is. Returns nil when config-src is nil or errors is nil.

render

(render config-src)(render config-src error)(render config-src error default)(render config-src error default req)(render config-src error default req a)(render config-src error default req a b)(render config-src error default req a b c)(render config-src error default req a b c d)(render config-src error default req a b c d e)(render config-src error default req a b c d e & more)

Renders an error or status response using render-fn. If the response rendering function cannot be established, configuration default is used. Returns nil when config-src is nil. Any additional arguments, including (and starting from) req are passed to the rendering function call.

render-fn

(render-fn config-src errors)(render-fn config-src errors default)

Gets a response rendering function using the given configuration source config-src (which may be of type ErrorsConfig, a request map, or a Match object) and errors (expressed as a keyword or a sequence of keywords). Returns nil when config-src or error is nil.

specific-id

(specific-id errors id src-id email-id phone-id)(specific-id errors src-id dst-id)

Makes errors errors more specific by replacing generic bad ID error (as a keyword) with a bad e-mail or phone error.