Fix handler lookup: use eval-expr to resolve handler:ex-* symbols
env-get requires (env-get env name) with two args but dispatch.sx was calling it with one arg, always returning nil. Now uses eval-expr + make-symbol to resolve the handler binding in the current env, with cek-try fallback to nil. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,11 +3,13 @@
|
||||
(fn
|
||||
(slug)
|
||||
(let
|
||||
((handler-key (str "handler:ex-" slug)) (hdef (env-get handler-key)))
|
||||
(if
|
||||
(nil? hdef)
|
||||
(error (str "Handler not found: " handler-key))
|
||||
(call-handler hdef)))))
|
||||
((handler-key (str "handler:ex-" slug)))
|
||||
(let
|
||||
((hdef (cek-try (fn () (eval-expr (make-symbol handler-key))) (fn (err) nil))))
|
||||
(if
|
||||
(nil? hdef)
|
||||
(error (str "Handler not found: " handler-key))
|
||||
(call-handler hdef))))))
|
||||
|
||||
(define
|
||||
call-handler
|
||||
|
||||
Reference in New Issue
Block a user