mirror of
https://github.com/taoensso/telemere.git
synced 2025-12-27 05:38:25 +00:00
[new] Add compile-time protection against accidental :msg_ signal option
This commit is contained in:
parent
7847bd1348
commit
ec92808ff4
1 changed files with 13 additions and 7 deletions
|
|
@ -625,13 +625,19 @@
|
|||
:elide? :allow? #_:expansion-id))]
|
||||
|
||||
;; Compile-time validation
|
||||
(when (and run-form error-form)
|
||||
(throw ; Prevent ambiguity re: source of error
|
||||
(ex-info "Signals cannot have both `:run` and `:error` opts at the same time"
|
||||
{:run-form run-form
|
||||
:error-form error-form
|
||||
:location location
|
||||
:other-opts (dissoc opts :run :error)})))
|
||||
(do
|
||||
(when (and run-form error-form) ; Ambiguous source of error
|
||||
(throw
|
||||
(ex-info "Signals cannot have both `:run` and `:error` opts at the same time"
|
||||
{:run-form run-form
|
||||
:error-form error-form
|
||||
:location location
|
||||
:other-opts (dissoc opts :run :error)})))
|
||||
|
||||
(when-let [e (find opts :msg_)] ; Common typo/confusion
|
||||
(throw
|
||||
(ex-info "Signals cannot have `:msg_` opt (did you mean `:msg`?))"
|
||||
{:msg_ (enc/typed-val (val e))}))))
|
||||
|
||||
`(delay
|
||||
;; Delay (cache) shared by all handlers. Covers signal `:let` eval, signal construction,
|
||||
|
|
|
|||
Loading…
Reference in a new issue