Liking cljdoc? Tell your friends :D

danger-mouse.utils


collect-results-mapclj

(collect-results-map xs)

Inputs: [xs :- [s/Any]] Returns: dm-schema/GroupedResults

Separate out errors and result from a vector argument and return them in a map.

Inputs: [xs :- [s/Any]]
Returns: dm-schema/GroupedResults

Separate out errors and result from a vector argument and return them
 in a map.
sourceraw docstring

handle-errorsclj

(handle-errors handler {:keys [errors result]})

Inputs: [handler :- (s/=> (s/named (s/eq nil) (quote Unit)) [s/Any]) {:keys [errors result]} :- dm-schema/GroupedResults] Returns: [s/Any]

After using collect-results-map to group values, this function will handle the errors portion using handler (which only produces side effects) and returns only the result.

Inputs: [handler :- (s/=> (s/named (s/eq nil) (quote Unit)) [s/Any]) {:keys [errors result]} :- dm-schema/GroupedResults]
Returns: [s/Any]

After using `collect-results-map` to group values, this function will handle the `errors`
 portion using `handler` (which only produces side effects) and returns only the `result`.
sourceraw docstring

on-errorclj

(on-error error-fn result)

Only apply error-fn to an error result (one marked with the appropriate keyword).

Only apply `error-fn` to an error `result` (one marked with the appropriate keyword).
sourceraw docstring

on-error-and-successclj

(on-error-and-success error-fn success-fn result)

Apply error-fn if the result is an error, and otherwise apply success-fn. Unlike resolve, this leaves an error as an error.

Apply `error-fn` if the `result` is an error, and otherwise apply `success-fn`.
Unlike `resolve`, this leaves an error as an error.
sourceraw docstring

on-successclj

(on-success success-fn result)

Only apply success-fn to a successful (i.e. unmarked) result.

Only apply `success-fn` to a successful (i.e. unmarked) `result`.
sourceraw docstring

resolveclj

(resolve error-fn success-fn result)

Apply error-fn to the error value if result is an error, otherwise apply success-fn. Unlike on-error-and-success, this will allow the user to transform an error into a success.

Apply `error-fn` to the error value if `result` is an error, otherwise apply `success-fn`.
Unlike `on-error-and-success`, this will allow the user to transform an error into a success.
sourceraw docstring

try-catch*clj

(try-catch* thunk)

Inputs: [thunk :- (s/=> s/Any)]

Function version of a try-catch block. The body must be provided as a thunk to delay processing. Macro version in danger-mouse.macros#try-catch.

Inputs: [thunk :- (s/=> s/Any)]

Function version of a try-catch block. The body must be provided as a thunk to delay processing.
 Macro version in `danger-mouse.macros#try-catch`.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close