| Addshore updated the task description. (Show Details) |
CHANGES TO TASK DESCRIPTION
I suppose we need to guard against this somewhere**The Plan** (extracted from a comment below)
From the investigation (T209368) we want to do the following
**1 - ValueFormatter interface**
The ValueFormatter interface should be documented as allowing InvalidArgumentExceptions to be thrown when arguments are known to be wrong for the type of Formatter instance.
Many instances of ValueFormatter already do this, but lets add it to the interface documentation.
**2 - EntityIdFormatter interface**
EntityIdFormatter interface should also document throwing an InvalidArgumentException when being provided with an argument that the current formatter can not format.
**3 - FormatSnakValue API**
EntityIdValueFormatter::format itself already throws InvalidArgumentExceptions, and the 2 cases above bubble up through this method.
When $valueFormatter->format is called in the FormatSnakValue API, InvalidArgumentExceptions from the call should be caught and exposed to the user as a regular API error, since API usage errors shouldn’t result in uncaughtnot an exceptions.
...
```I suppose we need to guard against this somewhere**The Plan** (extracted from a comment below)
From the investigation (T209368) we want to do the following
**1 - ValueFormatter interface**
The ValueFormatter interface should be documented as allowing InvalidArgumentExceptions to be thrown when arguments are known to be wrong for the type of Formatter instance.
Many instances of ValueFormatter already do this, but lets add it to the interface documentation.
**2 - EntityIdFormatter interface**
EntityIdFormatter interface should also document throwing an InvalidArgumentException when being provided with an argument that the current formatter can not format.
**3 - FormatSnakValue API**
EntityIdValueFormatter::format itself already throws InvalidArgumentExceptions, and the 2 cases above bubble up through this method.
When $valueFormatter->format is called in the FormatSnakValue API, InvalidArgumentExceptions from the call should be caught and exposed to the user as a regular API error, since API usage errors shouldn’t result in uncaughtnot an exceptions.
TASK DETAIL
EMAIL PREFERENCES
To: Addshore
Cc: Addshore, Lucas_Werkmeister_WMDE, Nandana, Mringgaard, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, Jonas, Wikidata-bugs, aude, Lydia_Pintscher, Darkdadaah, Jdforrester-WMF, Mbch331, Jay8g, Krenair
Cc: Addshore, Lucas_Werkmeister_WMDE, Nandana, Mringgaard, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, Jonas, Wikidata-bugs, aude, Lydia_Pintscher, Darkdadaah, Jdforrester-WMF, Mbch331, Jay8g, Krenair
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
