@@ -16,10 +16,10 @@ and MUST be emitted as soon as possible.
1616The other error categories are only emitted during formatting,
1717but it might be possible to detect them with validation tools.
1818
19- During selection, an _ expression _ handler MUST only emit _ Resolution Errors _ and _ Selection Errors _ .
20- During formatting, an _ expression_ handler MUST only emit _ Resolution Errors _ and _ Formatting Errors_ .
19+ During selection and formatting,
20+ _ expression_ handlers MUST only emit _ Message Function Errors_ .
2121
22- _ Resolution Errors_ and _ Formatting Errors_ in _ expressions_ that are not used
22+ _ Resolution Errors_ and _ Message Function Errors_ in _ expressions_ that are not used
2323in _ pattern selection_ or _ formatting_ MAY be ignored,
2424as they do not affect the output of the formatter.
2525
@@ -34,7 +34,7 @@ SHOULD prioritise _Syntax Errors_ and _Data Model Errors_ over others.
3434
3535When an error occurs within a _ selector_ ,
3636the _ selector_ MUST NOT match any _ variant_ _ key_ other than the catch-all ` * `
37- and a _ Resolution Error_ or a _ Selection Error_ MUST be emitted.
37+ and a _ Resolution Error_ or a _ Message Function Error_ MUST be emitted.
3838
3939## Syntax Errors
4040
@@ -241,49 +241,72 @@ or for private implementation use that is not supported by the current implement
241241> * {{The value is not one.}}
242242> ```
243243
244- ### Invalid Expression
244+ ### Unsupported Statement
245+
246+ An **_<dfn>Unsupported Statement</dfn>_** error occurs when a message includes a _reserved statement_.
247+
248+ > For example, attempting to format this message
249+ > would always result in an _Unsupported Statement_ error:
250+ >
251+ > ```
252+ > .some {|horse|}
253+ > {{The message body}}
254+ > ```
255+
256+ ## Message Function Errors
245257
246- An **_<dfn>Invalid Expression</dfn>_** error occurs when a _message_ includes an _expression_
258+ ### Bad Expression
259+
260+ A **_<dfn>Bad Expression</dfn>_** error occurs when a _message_ includes an _expression_
247261whose implementation-defined internal requirements produce an error during _function resolution_
248262or when a _function_ returns a value (such as `null`) that the implementation does not support.
249263
250- An **_<dfn>Operand Mismatch Error</dfn>_** is an _Invalid Expression_ error that occurs when
264+ > For example, the following _message_ might produce a _Bad Expression_ error if the
265+ > the function `:function` threw an exception or otherwise emitted an error
266+ > rather than returning a valid value:
267+ >
268+ > ```
269+ > This has a bad expression {$var :function} because it has a bug in it.
270+ > ```
271+
272+ ### Bad Operand
273+
274+ A **_<dfn>Bad Operand</dfn>_** error is an error that occurs when
251275an _operand_ provided to a _function_ during _function resolution_ does not match one of the
252276expected implementation-defined types for that function;
253277or in which a literal _operand_ value does not have the required format
254278and thus cannot be processed into one of the expected implementation-defined types
255279for that specific _function_.
256280
257- > For example, the following _message_ produces an _Operand Mismatch Error_
258- > (a type of _Invalid Expression_ error)
281+ > For example, the following _message_ produces a _Bad Operand_ error
259282> because the literal `|horse|` does not match the production `number-literal`,
260283> which is a requirement of the function `:number` for its operand:
284+ >
261285> ```
262286> .local $horse = {horse :number}
263287> {{You have a {$horse}.}}
264288> ```
265- > The following _message_ might produce an _Invalid Expression_ error if the
266- > the function `:function` threw an exception or otherwise emitted an error
267- > rather than returning a valid value:
268- >```
269- > {{This has an invalid expression {$var :function} because it has a bug in it.}}
270- >```
271289
272- ### Unsupported Statement
290+ ### Bad Option
273291
274- An **_<dfn>Unsupported Statement</dfn>_** error occurs when a message includes a _reserved statement_.
292+ A **_<dfn>Bad Option</dfn>_** error is an error that occurs when
293+ an _option_ value provided to a _function_ during _function resolution_ does not match one of the
294+ expected implementation-defined types for that function;
295+ or in which a literal _option_ value does not have the required format
296+ and thus cannot be processed into one of the expected implementation-defined types
297+ for that specific _function_.
275298
276- > For example, attempting to format this message
277- > would always result in an _Unsupported Statement_ error:
299+ > For example, the following _message_ might produce a _Bad Option_ error
300+ > because the literal `foo` does not match the production `number-literal`,
301+ > which is a requirement of the function `:number` for its `minimumFractionDigits` _option_:
278302>
279303> ```
280- > .some {|horse|}
281- > {{The message body}}
304+ > The answer is {42 :number minimumFractionDigits=foo}.
282305> ```
283306
284- ## Selection Errors
307+ ### Selection Error
285308
286- **_<dfn>Selection Errors </dfn>_** occur when message selection fails.
309+ A **_<dfn>Selection Error </dfn>_** occurs when message selection fails.
287310
288311> For example, attempting to format either of the following messages
289312> might result in a _Selection Error_ if done within a context that
@@ -302,9 +325,9 @@ An **_<dfn>Unsupported Statement</dfn>_** error occurs when a message includes a
302325> * {{The value is not one.}}
303326> ```
304327
305- ## Formatting Errors
328+ ### Formatting Error
306329
307- **_<dfn>Formatting Errors </dfn>_** occur during the formatting of a resolved value,
330+ A **_<dfn>Formatting Error </dfn>_** occurs during the formatting of a resolved value,
308331for example when encountering a value with an unsupported type
309332or an internally inconsistent set of options.
310333
0 commit comments