Application Description Language support - utility functions likely to be useful in user-written code.
Application Description Language support - utility functions likely to be useful in user-written code.
The idea here is to have a function with which to show warnings to the user, which can be dynamically bound. Any binding should be a function of one argument, which it should print, log, or otherwise display.
The idea here is to have a function with which to show warnings to the user, which can be dynamically bound. Any binding should be a function of one argument, which it should print, log, or otherwise display.
(compose-exception-reason exception)
(compose-exception-reason exception intro)
Compose and return a sensible reason message for this exception
.
Compose and return a sensible reason message for this `exception`.
(compose-reason-and-log exception)
(compose-reason-and-log exception intro)
Compose a reason message for this exception
, log it (with its
stacktrace), and return the reason message.
Compose a reason message for this `exception`, log it (with its stacktrace), and return the reason message.
(do-or-log-and-return-reason form)
Clojure stacktraces are unreadable. We have to do better; evaluate
this form
in a try-catch block; return a map. If the evaluation
succeeds, the map will have a key :result
whose value is the result;
otherwise it will have a key :error
which will be bound to the most
sensible error message we can construct. Additionally, log the exception
Clojure stacktraces are unreadable. We have to do better; evaluate this `form` in a try-catch block; return a map. If the evaluation succeeds, the map will have a key `:result` whose value is the result; otherwise it will have a key `:error` which will be bound to the most sensible error message we can construct. Additionally, log the exception
(do-or-log-error form
&
{:keys [message error-return]
:or {message (clojure.core/seq
(clojure.core/concat
(clojure.core/list (quote clojure.core/str))
(clojure.core/list "A failure occurred in ")
(clojure.core/list (list (quote quote)
form))))}})
Evaluate the supplied form
in a try/catch block. If the
keyword param :message
is supplied, the value will be used
as the log message; if the keyword param :error-return
is
supplied, the value will be returned if an exception is caught.
Evaluate the supplied `form` in a try/catch block. If the keyword param `:message` is supplied, the value will be used as the log message; if the keyword param `:error-return` is supplied, the value will be returned if an exception is caught.
(do-or-return-reason form)
(do-or-return-reason form intro)
Clojure stacktraces are unreadable. We have to do better; evaluate
this form
in a try-catch block; return a map. If the evaluation
succeeds, the map will have a key :result
whose value is the result;
otherwise it will have a key :error
which will be bound to the most
sensible error message we can construct.
Clojure stacktraces are unreadable. We have to do better; evaluate this `form` in a try-catch block; return a map. If the evaluation succeeds, the map will have a key `:result` whose value is the result; otherwise it will have a key `:error` which will be bound to the most sensible error message we can construct.
(do-or-warn form)
(do-or-warn form intro)
Evaluate this form
; if any exception is thrown, show it to the user
via the *warn*
mechanism.
Evaluate this `form`; if any exception is thrown, show it to the user via the `*warn*` mechanism.
(do-or-warn-and-log form)
(do-or-warn-and-log form intro)
Evaluate this form
; if any exception is thrown, log the reason and
show it to the user via the *warn*
mechanism.
Evaluate this `form`; if any exception is thrown, log the reason and show it to the user via the `*warn*` mechanism.
Sending empty strings, or numbers as strings, to the database often isn't
helpful. Massage these params
and form-params
to eliminate these problems.
We must take key field values out of just params, but we should take all other
values out of form-params - because we need the key to load the form in
the first place, but just accepting values of other params would allow spoofing.
Sending empty strings, or numbers as strings, to the database often isn't helpful. Massage these `params` and `form-params` to eliminate these problems. We must take key field values out of just params, but we should take all other values out of form-params - because we need the key to load the form in the first place, but just accepting values of other params would allow spoofing.
(massage-value k m)
Return a map with one key, this k
as a keyword, whose value is the binding of
k
in map m
, as read by read.
Return a map with one key, this `k` as a keyword, whose value is the binding of `k` in map `m`, as read by read.
(raw-massage-params request)
(raw-massage-params request entity)
Sending empty strings, or numbers as strings, to the database often isn't
helpful. Massage these params
and form-params
to eliminate these problems.
Date and time fields also need massaging.
Sending empty strings, or numbers as strings, to the database often isn't helpful. Massage these `params` and `form-params` to eliminate these problems. Date and time fields also need massaging.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close