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. --- stdlib/source/program/aedifex.lux | 8 ++++---- stdlib/source/program/aedifex/artifact/time/date.lux | 5 +++-- stdlib/source/program/aedifex/command/build.lux | 6 +++--- stdlib/source/program/aedifex/dependency/resolution.lux | 10 +++++----- stdlib/source/program/aedifex/hash.lux | 7 ++++--- stdlib/source/program/aedifex/profile.lux | 4 ++-- stdlib/source/program/aedifex/project.lux | 7 ++++--- stdlib/source/program/aedifex/repository/remote.lux | 6 +++--- 8 files changed, 28 insertions(+), 25 deletions(-) (limited to 'stdlib/source/program') diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index 27127e3da..dc378103b 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -9,7 +9,7 @@ ["[0]" io (.only IO)] ["[0]" maybe] ["[0]" try (.only Try) (.use "[1]#[0]" functor)] - ["[0]" exception (.only exception)] + ["[0]" exception] [concurrency ["[0]" async (.only Async) (.use "[1]#[0]" monad)]]] [data @@ -94,8 +94,8 @@ (in {try.#Failure ""})))] (in output))) -(exception (cannot_find_repository [repository Text - options (Dictionary Text Address)]) +(exception.def (cannot_find_repository [repository options]) + (Exception [Text (Dictionary Text Address)]) (exception.report (list ["Repository" (%.text repository)] ["Options" (exception.listing (function (_ [name repo]) @@ -126,7 +126,7 @@ (..fail! error)))) (at io.monad in []))) -(exception .public invalid_operation) +(exception.def .public invalid_operation) (`` (def write_only (Console IO) diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 84e33836a..d1f9a0899 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -7,7 +7,7 @@ [control ["<>" parser] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)]] + ["[0]" exception (.only Exception)]] [data ["[0]" text ["%" \\format] @@ -34,7 +34,8 @@ (def min_year +1,000) (def max_year +9,999) -(exception .public (year_is_out_of_range [year year.Year]) +(exception.def .public (year_is_out_of_range year) + (Exception year.Year) (exception.report (list ["Minimum" (%.int ..min_year)] ["Maximum" (%.int ..max_year)] diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 20492bf69..107ae46a4 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -7,7 +7,7 @@ [monad (.only do)]] [control ["[0]" try (.only Try) (.use "[1]#[0]" functor)] - ["[0]" exception (.only exception)] + ["[0]" exception] ["[0]" io (.only IO)] [concurrency ["[0]" async (.only Async) (.use "[1]#[0]" monad)]]] @@ -80,8 +80,8 @@ ["lux-ruby" ruby_lux_name] ) -(exception .public no_available_lux) -(exception .public no_specified_program) +(exception.def .public no_available_lux) +(exception.def .public no_specified_program) (type .public Lux (Variant diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 81eb16502..571d2d966 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -10,7 +10,7 @@ [control ["[0]" maybe] ["[0]" try (.only Try) (.use "[1]#[0]" functor)] - ["[0]" exception (.only Exception exception)] + ["[0]" exception (.only Exception)] [function ["[0]" predicate (.only Predicate)]] [concurrency @@ -60,9 +60,8 @@ ["[1]/[0]" snapshot]]]]) (with_template [] - [(exception .public ( [artifact Artifact - extension Extension - hash Text]) + [(exception.def .public ( [artifact extension hash]) + (Exception [Artifact Extension Text]) (exception.report (list ["Artifact" (///artifact.format artifact)] ["Extension" (%.text extension)] @@ -156,7 +155,8 @@ (Equivalence Resolution) (dictionary.equivalence ///package.equivalence)) -(exception .public (cannot_resolve [dependency Dependency]) +(exception.def .public (cannot_resolve dependency) + (Exception Dependency) (exception.report (list ["Artifact" (%.text (///artifact.format (the //.#artifact dependency)))] ["Type" (%.text (the //.#type dependency))]))) diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index eedf5e464..64e9784d3 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -81,15 +81,16 @@ (def hex_per_chunk (n.* hex_per_byte i64.bytes_per_i64)) - (exception .public (not_a_hash [size Nat - value Text]) + (exception.def .public (not_a_hash [size value]) + (Exception [Nat Text]) (exception.report (list ["Pseudo hash" (%.text value)] ["Expected size" (%.nat size)] ["Actual size" (%.nat (text.size value))]))) (with_template [ ] - [(exception .public ( [data Binary]) + [(exception.def .public ( data) + (Exception Binary) (exception.report (list ["Pseudo hash" (%.text (..encoded data))] ["Expected size" (%.nat )] diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index fa00bc64c..2d9d41b4c 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -6,7 +6,7 @@ [equivalence (.only Equivalence)]] [control ["[0]" maybe (.use "[1]#[0]" monoid)] - ["[0]" exception (.only exception)]] + ["[0]" exception]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" equivalence)] @@ -276,4 +276,4 @@ #lua (!runtime #lua runtime.default_lua) #ruby (!runtime #ruby runtime.default_ruby)])))) -(exception .public no_identity) +(exception.def .public no_identity) diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 2f4d853af..9d0a00f43 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -41,12 +41,13 @@ (def composite (dictionary.composite_with (at //.monoid composite))))) -(exception .public (unknown_profile [name Name]) +(exception.def .public (unknown_profile name) + (Exception Name) (exception.report (list ["Name" (%.text name)]))) -(exception .public (circular_dependency [dependee Name - dependent Name]) +(exception.def .public (circular_dependency [dependee dependent]) + (Exception [Name Name]) (exception.report (list ["Dependent" (%.text dependent)] ["Dependee" (%.text dependee)]))) diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index bb89a6235..34488b544 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -6,7 +6,7 @@ [control ["[0]" io (.only IO)] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)]] + ["[0]" exception (.only Exception)]] [data ["[0]" product] [text @@ -34,8 +34,8 @@ URL) (with_template [] - [(exception .public ( [url URL - status Nat]) + [(exception.def .public ( [url status]) + (Exception [URL Nat]) (exception.report (list ["URL" (%.text url)] ["Status Code" (%.nat status)])))] -- cgit v1.2.3