If true, default insist
will capture the values of all lexical bindings
used within the clause.
If true, default `insist` will capture the values of all lexical bindings used within the clause.
(deferror* custom-error error-name type generic-str)
(deferror* custom-error error-name type generic-str required-keys)
Defines a new error constructor and a specialized version of the recide/raise macro, where the type and the 'generic' portion of the error message are static and required arguments are specified via the final sequence of key-words. Defines two macros (for compile-time errors). The first is a constructor named error-name, with the signature: ([detail-msg data] [detail-msg data cause])
Also defined is a corresponding raise-
macro with the signature:
([detail-msg {:as extra-data}]
[detail-msg {:as extra-data} cause]).
Example: (deferror storage-timeout :storage/timeout "A storage operation timed out" [:method])
You can use the constructor like so: (storage-timeout "A call to get-value took too long." {:method 'get-value, :nodes-count (count kvs)})
This macro would expand into the following: (error :storage/timeout (str "A storage operation timed out: " "A call to get-value took too long.") {:method 'get-value, :nodes-count (count kvs)})
Using the generated raise- macro is similar: (raise-storage-timeout "A call to get-value took too long." {:method 'get-value :nodes-count (count kvs)})
This macro would expand similarly into a raise form. In both examples, if :method were left out of the data map, an exception would be thrown at compile time.
Defines a new error constructor and a specialized version of the recide/raise macro, where the type and the 'generic' portion of the error message are static and required arguments are specified via the final sequence of key-words. Defines two macros (for compile-time errors). The first is a constructor named error-name, with the signature: ([detail-msg data] [detail-msg data cause]) Also defined is a corresponding `raise-` macro with the signature: ([detail-msg {:as extra-data}] [detail-msg {:as extra-data} cause]). Example: (deferror storage-timeout :storage/timeout "A storage operation timed out" [:method]) You can use the constructor like so: (storage-timeout "A call to get-value took too long." {:method 'get-value, :nodes-count (count kvs)}) This macro would expand into the following: (error :storage/timeout (str "A storage operation timed out: " "A call to get-value took too long.") {:method 'get-value, :nodes-count (count kvs)}) Using the generated raise- macro is similar: (raise-storage-timeout "A call to get-value took too long." {:method 'get-value :nodes-count (count kvs)}) This macro would expand similarly into a raise form. In both examples, if :method were left out of the data map, an exception would be thrown at compile time.
(deferror-group* custom-error error-name group-key subtypes)
Defines specialized (macro) variants of recide/error and recide/raise, for working with a namespaced family of error types. For each subtype, the 'generic' portion of the error message is static. Required data keywords can be specified for both the entire family of errors and for each subtype.
Both the constructor and raise macros have the same signature: ([subtype detail-msg {:as extra-data}] [subtype detail-msg {:as extra-data} cause]).
Example: (deferror-group parse-err (:query.invalid [:expression]) (find-spec "Invalid find spec") (inputs "Invalid inputs" [:invalid]))
An example of using the constructor is: (parse-err :inputs "Input arguments must be integers" {:expression spec, :invalid (remove input? args)})
This would expand into the following: (error :query.invalid/inputs (str "Invalid inputs" ":" "Input arguments must be integers" {:expresion spec, :invalid (remove input? args)})
To use the raise form, you would replace parse-err
with raise-parse-err
. In either case
in this example, if either :expression or :invalid were left out of the data map, an
exception would be thrown at compile time.
Defines specialized (macro) variants of recide/error and recide/raise, for working with a namespaced family of error types. For each subtype, the 'generic' portion of the error message is static. Required data keywords can be specified for both the entire family of errors and for each subtype. Both the constructor and raise macros have the same signature: ([subtype detail-msg {:as extra-data}] [subtype detail-msg {:as extra-data} cause]). Example: (deferror-group parse-err (:query.invalid [:expression]) (find-spec "Invalid find spec") (inputs "Invalid inputs" [:invalid])) An example of using the constructor is: (parse-err :inputs "Input arguments must be integers" {:expression spec, :invalid (remove input? args)}) This would expand into the following: (error :query.invalid/inputs (str "Invalid inputs" ":" "Input arguments must be integers" {:expresion spec, :invalid (remove input? args)}) To use the raise form, you would replace `parse-err` with `raise-parse-err`. In either case in this example, if either :expression or :invalid were left out of the data map, an exception would be thrown at compile time.
(error type msg data)
(error type msg data cause)
Returns a recide error (IExceptionInfo) with the type (keyword), msg (string), data (map), and cause (Throwable). Merges the following map onto the ex-data:
For Example: {:recide/error recide.error.ErrorForm@447521e, :recide/type type}
ErrorForm definition: recide.impl/default-error-definition
Constructor: clojure.core$ex_info
Returns a recide error (IExceptionInfo) with the type (keyword), msg (string), data (map), and cause (Throwable). Merges the following map onto the ex-data: For Example: `{:recide/error recide.error.ErrorForm@447521e, :recide/type type}` ErrorForm definition: `recide.impl/default-error-definition` Constructor: `clojure.core$ex_info`
(error->map x)
Verifies that the IExceptionInfo is a recide error, then converts it to map form.
Verifies that the IExceptionInfo is a recide error, then converts it to map form.
(error-map type msg data)
(error-map type msg data cause)
Returns a map representing a recide error with the type (keyword), msg (string), data map, and cause.
{recide.impl/default-error-definition type, :recide/type msg, :recide/msg data, :recide/data cause, :recide/cause <serialized-form>}
ErrorForm definition: :recide.serialized-throwable/v1 Constructor: clojure.core$ex_info
Returns a map representing a recide error with the type (keyword), msg (string), data map, and cause. {recide.impl/default-error-definition type, :recide/type msg, :recide/msg data, :recide/data cause, :recide/cause <serialized-form>} ErrorForm definition: :recide.serialized-throwable/v1 Constructor: clojure.core$ex_info
(error-map* custom-error type msg data)
(error-map* custom-error type msg data cause)
Creates the map form of a recide error with the type (keyword), msg (string), data map, and cause.
Creates the map form of a recide error with the type (keyword), msg (string), data map, and cause.
(error-map->throwable err)
Verifies that the map is polymorphic to a recide error, then converts it back into an IExceptionInfo. It will use the ErrorForm (and constructor) designated in the map by :recide/error.
Verifies that the map is polymorphic to a recide error, then converts it back into an IExceptionInfo. It will use the ErrorForm (and constructor) designated in the map by :recide/error.
(error-map? x)
(error-map? x type)
Checks whether the given map constitutes a valid recide error. If a keyword type is provided, this also verifies that the error is of that type. Matches :namespace/* as a partial wildcard for error types.
Checks whether the given map constitutes a valid recide error. If a keyword type is provided, this also verifies that the error is of that type. Matches :namespace/* as a partial wildcard for error types.
(error-type x)
Accepts a recide error or error-map. Returns nil when it's not. Not safe for use in a custom constructor unless serialization/deserialization is out of the question.
Accepts a recide error or error-map. Returns nil when it's not. Not safe for use in a custom constructor unless serialization/deserialization is out of the question.
(error? x)
(error? x type)
Checks whether the given IExceptionInfo is a recide error. If a type keyword is provided, it also checks that the error has that type.
Checks whether the given IExceptionInfo is a recide error. If a type keyword is provided, it also checks that the error has that type.
(generate-custom-error-library custom-error capture-flag)
(generate-deferror* custom-error)
custom-error is fully-qualified symbol.
custom-error is fully-qualified symbol.
(generate-raise* custom-error)
custom-error must be fully-qualified symbols.
custom-error must be fully-qualified symbols.
(insist expr)
(insist expr message)
Same syntax as assert. If assertion is disabled, insistence will also be disabled. Throws an IExceptionInfo if expr does not evaluate to logical true. recide.impl/default-error-definition is the constructor used.
Otherwise, it acts like recide/raise, constructing a recide error of the following form: {:recide/type :recide/assertion, :recide/msg msg, :recide/data <data>, :recide.serialized-throwable/v1 <serialized-form>}
When recide.impl/capture-insists is true, this will also capture the bindings of symbols used in the assertion, inserting these values into the data map. recide.impl/capture-insists is false by default, unless one of the following was true at class load: (1) env var is true: RECIDERE_CAPTURE_INSISTS (2) system property is set: recide.capture-insists
Same syntax as assert. If assertion is disabled, insistence will also be disabled. Throws an IExceptionInfo if expr does not evaluate to logical true. recide.impl/default-error-definition is the constructor used. Otherwise, it acts like recide/raise, constructing a recide error of the following form: {:recide/type :recide/assertion, :recide/msg msg, :recide/data <data>, :recide.serialized-throwable/v1 <serialized-form>} When recide.impl/*capture-insists* is true, this will also capture the bindings of symbols used in the assertion, inserting these values into the data map. recide.impl/*capture-insists* is false by default, unless one of the following was true at class load: (1) env var is true: RECIDERE_CAPTURE_INSISTS (2) system property is set: recide.capture-insists
(insist* capture-flag custom-error expr)
(insist* capture-flag custom-error expr message)
capture-flag, raised-sites, and custom-error must be fully-qualified symbols. Same syntax as assert. If assertion is disabled, insistence will also be disabled. Throws an exception if expr does not evaluate to logical true.
Otherwise, it acts like recide/raise, with type :recide/assertion. The bindings of symbols used in the assertion are inserted into the info map.
capture-flag, raised-sites, and custom-error must be fully-qualified symbols. Same syntax as assert. If assertion is disabled, insistence will also be disabled. Throws an exception if expr does not evaluate to logical true. Otherwise, it acts like recide/raise, with type :recide/assertion. The bindings of symbols used in the assertion are inserted into the info map.
(raise type msg data)
(raise type msg data cause)
Records this raise-site on the ErrorForm definition, and constructs an IExceptionInfo as a recide-style error.
ErrorForm: recide.impl/default-error-definition Constructor: clojure.core$ex_info
Merges the following map onto the data: {:recide/error recide.impl/default-error-definition, :recide/type type}
Records this raise-site on the ErrorForm definition, and constructs an IExceptionInfo as a recide-style error. ErrorForm: recide.impl/default-error-definition Constructor: clojure.core$ex_info Merges the following map onto the data: {:recide/error recide.impl/default-error-definition, :recide/type type}
(raise* custom-error type msg data)
(raise* custom-error type msg data cause)
raised-sites and custom-error are fully-qualified symbols Records this raise-site for the error type, and expands into:
(throw (error {:recide/type type, :recide/msg msg, :recide/data data, :recide/cause cause}))
raised-sites and custom-error are fully-qualified symbols Records this raise-site for the error type, and expands into: (throw (error {:recide/type type, :recide/msg msg, :recide/data data, :recide/cause cause}))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close