diff options
Diffstat (limited to 'stdlib/source/lux/control/exception.lux')
-rw-r--r-- | stdlib/source/lux/control/exception.lux | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index a8252977f..aac879cb7 100644 --- a/stdlib/source/lux/control/exception.lux +++ b/stdlib/source/lux/control/exception.lux @@ -6,7 +6,6 @@ ["p" parser ["s" code (#+ Parser)]]] [data - ["//" error (#+ Error)] ["." maybe] ["." product] ["." text ("#@." monoid)] @@ -20,7 +19,9 @@ [syntax ["cs" common ["csr" reader] - ["csw" writer]]]]]) + ["csw" writer]]]]] + [// + ["//" try (#+ Try)]]) (type: #export (Exception a) {#.doc "An exception provides a way to decorate error messages."} @@ -35,8 +36,8 @@ {#.doc (doc "If a particular exception is detected on a possibly-erroneous value, handle it." "If no exception was detected, or a different one from the one being checked, then pass along the original value.")} (All [e a] - (-> (Exception e) (-> Text a) (Error a) - (Error a))) + (-> (Exception e) (-> Text a) (Try a) + (Try a))) (case try (#//.Success output) (#//.Success output) @@ -53,7 +54,7 @@ (def: #export (otherwise to-do try) {#.doc "If no handler could be found to catch the exception, then run a function as a last-resort measure."} (All [a] - (-> (-> Text a) (Error a) a)) + (-> (-> Text a) (Try a) a)) (case try (#//.Success output) output @@ -63,7 +64,7 @@ (def: #export (return value) {#.doc "A way to lift normal values into the error-handling context."} - (All [a] (-> a (Error a))) + (All [a] (-> a (Try a))) (#//.Success value)) (def: #export (construct exception message) @@ -73,11 +74,11 @@ (def: #export (throw exception message) {#.doc "Decorate an error message with an Exception and lift it into the error-handling context."} - (All [e] (-> (Exception e) e Error)) + (All [e] (-> (Exception e) e Try)) (#//.Failure (construct exception message))) (def: #export (assert exception message test) - (All [e] (-> (Exception e) e Bit (Error Any))) + (All [e] (-> (Exception e) e Bit (Try Any))) (if test (#//.Success []) (..throw exception message))) @@ -154,7 +155,7 @@ error)) (def: #export (with-stack exception message computation) - (All [e a] (-> (Exception e) e (Error a) (Error a))) + (All [e a] (-> (Exception e) e (Try a) (Try a))) (case computation (#//.Failure error) (#//.Failure (case error |