aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control/exception.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/control/exception.lux')
-rw-r--r--stdlib/source/library/lux/control/exception.lux23
1 files changed, 9 insertions, 14 deletions
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux
index a7d5a5871..1edd4bc04 100644
--- a/stdlib/source/library/lux/control/exception.lux
+++ b/stdlib/source/library/lux/control/exception.lux
@@ -37,7 +37,7 @@
(All [e] (-> (Exception e) Text Bit))
(text.starts_with? (get@ #label exception) error))
-(def: .public (catch exception then try)
+(def: .public (when exception then try)
{#.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]
@@ -67,11 +67,6 @@
(#//.Failure error)
(else error)))
-(def: .public (return value)
- {#.doc "A way to lift normal values into the error-handling context."}
- (All [a] (-> a (Try a)))
- (#//.Success value))
-
(def: .public (error exception message)
{#.doc "Constructs an error message from an exception."}
(All [e] (-> (Exception e) e Text))
@@ -135,18 +130,18 @@
0
entries)
on_new_line (|> " "
- (list.repeat (n.+ (text.size header_separator)
- largest_header_size))
+ (list.repeated (n.+ (text.size header_separator)
+ largest_header_size))
(text.join_with "")
(text\compose text.new_line))
on_entry (: (-> [Text Text] Text)
(function (_ [header message])
(let [padding (|> " "
- (list.repeat (n.- (text.size header)
- largest_header_size))
+ (list.repeated (n.- (text.size header)
+ largest_header_size))
(text.join_with ""))]
(|> message
- (text.replace_all text.new_line on_new_line)
+ (text.replaced text.new_line on_new_line)
($_ text\compose padding header header_separator)))))]
(case entries
#.End
@@ -186,13 +181,13 @@
(def: separator
(let [gap ($_ "lux text concat" text.new_line text.new_line)
- horizontal_line (|> "-" (list.repeat 64) (text.join_with ""))]
+ horizontal_line (|> "-" (list.repeated 64) (text.join_with ""))]
($_ "lux text concat"
gap
horizontal_line
gap)))
-(def: (decorate prelude error)
+(def: (decorated prelude error)
(-> Text Text Text)
($_ "lux text concat"
prelude
@@ -209,7 +204,7 @@
(..error exception message)
_
- (..decorate (..error exception message) error)))
+ (..decorated (..error exception message) error)))
success
success))