1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-11 19:18:07 +00:00

Improve messages on errors when loading the bundle script

This commit is contained in:
Michael Camilleri
2025-11-21 22:45:36 +09:00
parent 7c1db67749
commit ee46315e1d

View File

@@ -4224,7 +4224,13 @@
(put new-env :bundle-dir (bundle-dir bundle-name)) # get the syspath right
(try
(require (string "@syspath/bundle/" bundle-name))
([_] (error "bundle must contain bundle.janet or bundle/init.janet"))))))
([e f]
(def pfx "could not find module @syspath/bundle/")
(def msg (if (and (string? e)
(string/has-prefix? pfx e))
"bundle must contain bundle.janet or bundle/init.janet"
e))
(propagate msg f))))))
(defn- do-hook
[module bundle-name hook & args]