From ebd08e3137d300dae6344550f5b53a9849534f86 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 8 Jul 2024 16:33:49 +0300 Subject: [PATCH 1/5] Refine error handling text --- spec/errors.md | 13 ++++++++++--- spec/formatting.md | 5 ++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/spec/errors.md b/spec/errors.md index 1fa78c8a2..32600b653 100644 --- a/spec/errors.md +++ b/spec/errors.md @@ -24,9 +24,16 @@ or _Message Function Errors_ in _expressions_ that are not otherwise used by the such as _placeholders_ in unselected _patterns_ or _declarations_ that are never referenced during _formatting_. -In all cases, when encountering a runtime error, -a message formatter MUST provide some representation of the message. -An informative error or errors MUST also be separately provided. +When formatting a message with one or more errors: +- An implementation MUST provide a way for a user to be informed + of the name of at least one of the errors, + either directly or via an identifying error code. +- An implementation MUST provide a way for a message with one or more + _Resolution Errors_ or _Message Function Errors_ to be formatted + using a fallback representation. + +The two above requirements MAY be fulfilled by a single formatting method, +or separately by more than one such method. When a message contains more than one error, or contains some error which leads to further errors, diff --git a/spec/formatting.md b/spec/formatting.md index 6027175d3..af9f8e6ab 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -735,9 +735,8 @@ each _text_ and _placeholder_ part of the selected _pattern_ is resolved and for Resolved values cannot always be formatted by a given implementation. When such an error occurs during _formatting_, -an implementation SHOULD emit an appropriate _Message Function Error_ and produce a -_fallback value_ for the _placeholder_ that produced the error. -A formatting function MAY substitute a value to use instead of a _fallback value_. +an implementation MUST emit an appropriate _Message Function Error_ and use a +_fallback value_ for the _placeholder_ with the error. Implementations MAY represent the result of _formatting_ using the most appropriate data type or structure. Some examples of these include: From 4ca923afbe4747f09f0712445e032ff17128421f Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Wed, 10 Jul 2024 14:17:30 +0300 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Addison Phillips --- spec/errors.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spec/errors.md b/spec/errors.md index 32600b653..1a54a8497 100644 --- a/spec/errors.md +++ b/spec/errors.md @@ -24,10 +24,13 @@ or _Message Function Errors_ in _expressions_ that are not otherwise used by the such as _placeholders_ in unselected _patterns_ or _declarations_ that are never referenced during _formatting_. -When formatting a message with one or more errors: -- An implementation MUST provide a way for a user to be informed - of the name of at least one of the errors, - either directly or via an identifying error code. +When formatting a _message_ with one or more errors: +- An implementation MUST provide a mechanism to discover and identify + at least one of the errors. + The exact form of error signaling is implementation defined. + Some examples include throwing an exception, + returning an error code, + or providing a function or method for enumerating any errors. - An implementation MUST provide a way for a message with one or more _Resolution Errors_ or _Message Function Errors_ to be formatted using a fallback representation. From 316331fec46cc33077559ccb9ecd3255ddfe97f2 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 29 Jul 2024 13:17:44 +0300 Subject: [PATCH 3/5] Update fallback text --- spec/errors.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/errors.md b/spec/errors.md index 1a54a8497..ba2a78b50 100644 --- a/spec/errors.md +++ b/spec/errors.md @@ -31,9 +31,9 @@ When formatting a _message_ with one or more errors: Some examples include throwing an exception, returning an error code, or providing a function or method for enumerating any errors. -- An implementation MUST provide a way for a message with one or more - _Resolution Errors_ or _Message Function Errors_ to be formatted - using a fallback representation. +- For all messages without _Syntax Errors_ or _Data Model Errors_, + an implementation MUST enable a user to get a formatted result. + This result MAY include formatted _fallback values_. The two above requirements MAY be fulfilled by a single formatting method, or separately by more than one such method. From 180d04555e677e255b7160d64abeb2c8f53b7dbc Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 29 Jul 2024 13:20:27 +0300 Subject: [PATCH 4/5] Turn bullet point list into paragraphs --- spec/errors.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/spec/errors.md b/spec/errors.md index ba2a78b50..4148fe50a 100644 --- a/spec/errors.md +++ b/spec/errors.md @@ -24,16 +24,17 @@ or _Message Function Errors_ in _expressions_ that are not otherwise used by the such as _placeholders_ in unselected _patterns_ or _declarations_ that are never referenced during _formatting_. -When formatting a _message_ with one or more errors: -- An implementation MUST provide a mechanism to discover and identify - at least one of the errors. - The exact form of error signaling is implementation defined. - Some examples include throwing an exception, - returning an error code, - or providing a function or method for enumerating any errors. -- For all messages without _Syntax Errors_ or _Data Model Errors_, - an implementation MUST enable a user to get a formatted result. - This result MAY include formatted _fallback values_. +When formatting a _message_ with one or more errors, +an implementation MUST provide a mechanism to discover and identify +at least one of the errors. +The exact form of error signaling is implementation defined. +Some examples include throwing an exception, +returning an error code, +or providing a function or method for enumerating any errors. + +For all _messages_ without _Syntax Errors_ or _Data Model Errors_, +an implementation MUST enable a user to get a formatted result. +This result MAY include formatted _fallback values_. The two above requirements MAY be fulfilled by a single formatting method, or separately by more than one such method. From 45bd2bb591b3613856ba1f4dc32cccb75eeda345 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 29 Jul 2024 19:20:27 +0300 Subject: [PATCH 5/5] Be more mighty Co-authored-by: Addison Phillips --- spec/errors.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/errors.md b/spec/errors.md index 4148fe50a..a10dd0651 100644 --- a/spec/errors.md +++ b/spec/errors.md @@ -34,7 +34,9 @@ or providing a function or method for enumerating any errors. For all _messages_ without _Syntax Errors_ or _Data Model Errors_, an implementation MUST enable a user to get a formatted result. -This result MAY include formatted _fallback values_. +The formatted result might include _fallback values_ +such as when a _placeholder_'s _expression_ produced an error +during formatting. The two above requirements MAY be fulfilled by a single formatting method, or separately by more than one such method.