Skip to content

Commit

Permalink
Refine error handling text (#816)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
eemeli and aphillips authored Aug 26, 2024
1 parent 42c1f97 commit 14fd7b5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
19 changes: 16 additions & 3 deletions spec/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,22 @@ 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 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.
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.

When a message contains more than one error,
or contains some error which leads to further errors,
Expand Down
5 changes: 2 additions & 3 deletions spec/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,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:
Expand Down

0 comments on commit 14fd7b5

Please sign in to comment.