Skip to content

Commit 14fd7b5

Browse files
eemeliaphillips
andauthored
Refine error handling text (#816)
* Refine error handling text * Apply suggestions from code review Co-authored-by: Addison Phillips <[email protected]> * Update fallback text * Turn bullet point list into paragraphs * Be more mighty Co-authored-by: Addison Phillips <[email protected]> --------- Co-authored-by: Addison Phillips <[email protected]>
1 parent 42c1f97 commit 14fd7b5

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

spec/errors.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,22 @@ or _Message Function Errors_ in _expressions_ that are not otherwise used by the
2424
such as _placeholders_ in unselected _patterns_
2525
or _declarations_ that are never referenced during _formatting_.
2626

27-
In all cases, when encountering a runtime error,
28-
a message formatter MUST provide some representation of the message.
29-
An informative error or errors MUST also be separately provided.
27+
When formatting a _message_ with one or more errors,
28+
an implementation MUST provide a mechanism to discover and identify
29+
at least one of the errors.
30+
The exact form of error signaling is implementation defined.
31+
Some examples include throwing an exception,
32+
returning an error code,
33+
or providing a function or method for enumerating any errors.
34+
35+
For all _messages_ without _Syntax Errors_ or _Data Model Errors_,
36+
an implementation MUST enable a user to get a formatted result.
37+
The formatted result might include _fallback values_
38+
such as when a _placeholder_'s _expression_ produced an error
39+
during formatting.
40+
41+
The two above requirements MAY be fulfilled by a single formatting method,
42+
or separately by more than one such method.
3043

3144
When a message contains more than one error,
3245
or contains some error which leads to further errors,

spec/formatting.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,8 @@ each _text_ and _placeholder_ part of the selected _pattern_ is resolved and for
741741
742742
Resolved values cannot always be formatted by a given implementation.
743743
When such an error occurs during _formatting_,
744-
an implementation SHOULD emit an appropriate _Message Function Error_ and produce a
745-
_fallback value_ for the _placeholder_ that produced the error.
746-
A formatting function MAY substitute a value to use instead of a _fallback value_.
744+
an implementation MUST emit an appropriate _Message Function Error_ and use a
745+
_fallback value_ for the _placeholder_ with the error.
747746
748747
Implementations MAY represent the result of _formatting_ using the most
749748
appropriate data type or structure. Some examples of these include:

0 commit comments

Comments
 (0)