Page MenuHomePhabricator

#iferror should suppress scribunto error tracking category too
Closed, DeclinedPublic

Description

As demonstrated in https://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&oldid=645888452 #iferror correctly suppresses the scribunto error, but still adds the error category. I feel this behaviour is a little odd, it's like throwing an error and catching a bit of it. Whilst there are arguably better ways to handle scribunto errors, as the conversion from wikitext template to modules is always going to be a gradual transition users should be able to address this type of issue as they get to them not be forced to have a category full of false positives.

This might cause a similar issue when T25959 is fixed as the parser function error categories are added through interface messages instead of with addTrackingCategory like Scribunto.

Event Timeline

onei raised the priority of this task from to Needs Triage.
onei updated the task description. (Show Details)
onei added projects: Scribunto, ParserFunctions.
onei subscribed.

Unfortunately this isn't as simple as it might at first appear. #iferror takes its argument to test as the parameter after the colon, which is always expanded before #iferror is ever called, which means that #iferror has no way to know about any categories that may have been set during that expansion.

I disagree that we should do this. Lua errors should be handled by pcall() and not be allowed to escape back to wikitext at all.

Aklapper triaged this task as Lowest priority.Feb 6 2015, 8:52 PM

Even if you don't want to change this behavior, it should probably be mentioned in the documentation of #iferror. Because of this limitation, the function is practically useless when used with Scribunto.

Legoktm subscribed.

Declining per:

I disagree that we should do this. Lua errors should be handled by pcall() and not be allowed to escape back to wikitext at all.

I've documented this as a limitation of {{#iferror:}} as suggested above: https://www.mediawiki.org/w/index.php?diff=5481556&oldid=5449894&title=Help%3AExtension%3AParserFunctions&type=revision