aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/io.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/io.jvm.lux')
-rw-r--r--new-luxc/source/luxc/io.jvm.lux20
1 files changed, 13 insertions, 7 deletions
diff --git a/new-luxc/source/luxc/io.jvm.lux b/new-luxc/source/luxc/io.jvm.lux
index fdda1520c..482250f63 100644
--- a/new-luxc/source/luxc/io.jvm.lux
+++ b/new-luxc/source/luxc/io.jvm.lux
@@ -17,9 +17,14 @@
(def: host-extension Text ".jvm")
(def: lux-extension Text ".lux")
-(exception: #export File-Not-Found)
-(exception: #export Module-Not-Found)
-(exception: #export Could-Not-Prepare-Module)
+(do-template [<name>]
+ [(exception: #export (<name> {message Text})
+ message)]
+
+ [File-Not-Found]
+ [Module-Not-Found]
+ [Could-Not-Prepare-Module]
+ )
(def: sanitize
(-> Text Text)
@@ -29,7 +34,7 @@
(-> (List File) Text (Process [Text File]))
(case dirs
#.Nil
- (io.fail (File-Not-Found path))
+ (io.fail (ex.construct File-Not-Found path))
(#.Cons dir dirs')
(do io.Monad<Process>
@@ -61,7 +66,7 @@
($_ either
(find-source dirs (format name host-extension lux-extension))
(find-source dirs (format name lux-extension))
- (io.fail (Module-Not-Found name))))
+ (io.fail (ex.construct Module-Not-Found name))))
blob (file.read file)]
(wrap [path (blob-to-text blob)])))
@@ -88,8 +93,9 @@
(file.make-directory module-path))]
(if made-dir?
(wrap [])
- (io.fail (Could-Not-Prepare-Module (format "Module: " module-name "\n"
- "Target: " target-dir "\n"))))))
+ (io.fail (ex.construct Could-Not-Prepare-Module
+ (format "Module: " module-name "\n"
+ "Target: " target-dir "\n"))))))
(def: #export (write target name content)
(-> File Text Blob (Process Unit))