Liking cljdoc? Tell your friends :D

utilis.exception


throw-ifclj/smacro

(throw-if v)

Throw 'v' if is throwable otherwise return it as is.

Throw 'v' if is throwable otherwise return it as is.
source (clj)source (cljs)raw docstring

with-exception->valueclj/smacro

(with-exception->value exception-mapping & body)

Evaluates body & returns its result. In the event of an exception, 'exception-mapping's can be provided which map an exception type to a sentinel value that can be returned in it's place.

An exception type not specified in 'exception-map' will not be caught.

e.g., (with-exception->value [Exception :something-wrong NumberFormatException :could-not-covert] (Long/parseLong "foo"))

Evaluates body & returns its result. In the event of an exception,
'exception-mapping's can be provided which map an exception type to
a sentinel value that can be returned in it's place.

An exception type not specified in 'exception-map' will not be
caught.

e.g.,
  (with-exception->value
    [Exception :something-wrong
     NumberFormatException :could-not-covert]
    (Long/parseLong "foo"))
source (clj)source (cljs)raw docstring

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

× close