From e5625dd840a8b8adc76987f649da254335d3d93a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 11 Aug 2022 16:50:42 -0400 Subject: Improved exception-definition macro. --- lux-js/source/program.lux | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lux-js/source') diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 233db1518..665b4e8aa 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -9,7 +9,7 @@ [control ["[0]" maybe (.use "[1]#[0]" monad)] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] + ["[0]" exception (.only Exception)] ["[0]" io (.only IO io)] ["[0]" function] [concurrency @@ -70,7 +70,8 @@ [program ["/" compositor]]) -(exception (null_has_no_lux_representation [code (Maybe _.Expression)]) +(exception.def (null_has_no_lux_representation code) + (Exception (Maybe _.Expression)) (when code {.#Some code} (_.code code) @@ -153,8 +154,8 @@ [StructureValue] ) - (exception (unknown_member [member Text - object java/lang/Object]) + (exception.def (unknown_member [member object]) + (Exception [Text java/lang/Object]) (exception.report (list ["Member" member] ["Object" (debug.inspection object)]))) @@ -320,9 +321,10 @@ (as java/lang/Object))) )))) - (exception undefined_has_no_lux_representation) + (exception.def undefined_has_no_lux_representation) - (exception (unknown_kind_of_host_object [object java/lang/Object]) + (exception.def (unknown_kind_of_host_object object) + (Exception java/lang/Object) (exception.report (list ["Class" (ffi.of_string (java/lang/Object::toString (java/lang/Object::getClass object)))] ["Object" (ffi.of_string (java/lang/Object::toString object))] @@ -486,7 +488,8 @@ (array.has! 1 (to_js lux))) macro)))) - (exception (cannot_apply_a_non_function [object java/lang/Object]) + (exception.def (cannot_apply_a_non_function object) + (Exception java/lang/Object) (exception.report (list ["Object" (ffi.of_string (java/lang/Object::toString object))]))) -- cgit v1.2.3