mirror of
https://github.com/taoensso/telemere.git
synced 2026-01-29 09:20:35 +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))]
|
:elide? :allow? #_:expansion-id))]
|
||||||
|
|
||||||
;; Compile-time validation
|
;; Compile-time validation
|
||||||
(when (and run-form error-form)
|
(do
|
||||||
(throw ; Prevent ambiguity re: source of error
|
(when (and run-form error-form) ; Ambiguous source of error
|
||||||
(ex-info "Signals cannot have both `:run` and `:error` opts at the same time"
|
(throw
|
||||||
{:run-form run-form
|
(ex-info "Signals cannot have both `:run` and `:error` opts at the same time"
|
||||||
:error-form error-form
|
{:run-form run-form
|
||||||
:location location
|
:error-form error-form
|
||||||
:other-opts (dissoc opts :run :error)})))
|
: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
|
||||||
;; Delay (cache) shared by all handlers. Covers signal `:let` eval, signal construction,
|
;; Delay (cache) shared by all handlers. Covers signal `:let` eval, signal construction,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue