Skip to content

Commit

Permalink
Check ns is required before sci-copy-nss
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed Oct 7, 2024
1 parent 6c7e35e commit bbf83ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nextjournal/clerk/render/macros.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

(defmacro sci-copy-nss [& nss]
(into {} (for [[_ ns] nss]
[(list 'quote ns) `(sci.core/copy-ns ~ns (sci.core/create-ns '~ns))])))
`[(quote ~ns)
(if (empty? (ns-publics (quote ~ns)))
(throw (ex-info (str "Namespace " (quote ~ns) " is empty, forgot to require?") {:ns (quote ~ns)}))
(sci.core/copy-ns ~ns (sci.core/create-ns '~ns)))])))

#_(macroexpand '(sci-copy-nss 'nextjournal.clerk.render.hoooks
'nextjournal.clerk.render.code))

0 comments on commit bbf83ca

Please sign in to comment.