22 lines
No EOL
607 B
Text
22 lines
No EOL
607 B
Text
(seq
|
|
(fn throw! []
|
|
(throw.runtime_error! (str.join "" %%)))
|
|
(fn panic! [v]
|
|
(throw.panic! v))
|
|
(fn unreachable! []
|
|
(throw! "Reached unreachable code"))
|
|
(fn not_implemented! []
|
|
(throw! "Not implemented"))
|
|
(def try builtins.errors.try)
|
|
|
|
(defmacro catch [pattern then]
|
|
(lambda [msg type] (if-eq (type $pattern)
|
|
$then
|
|
:null)))
|
|
|
|
(namespace throw
|
|
(def panic! builtins.errors.throw_panic)
|
|
(def type_error! builtins.errors.throw_type_error)
|
|
(def arity_error! builtins.errors.throw_arity_error)
|
|
(def runtime_error! builtins.errors.throw_runtime_error)
|
|
)) |