Module talk:Error
Appearance
Some tests
I have edited Module:Error/testcases [1] and Template:Error/sandbox [2]. If these edits are not helpful, feel free to revert. My self comments:
- Adding
|tag={{{tag}}}
to the /sandbox looks obvious, since we want to pass that parameter. - /sandbox: Merging params into
{{{message|{{{1}}}}}}
in the /sandbox is done to copy the behaviour of the existing template. Since handling spaces and priorities in parameter handling will remain, we would like to copy that behaviour, whatever the implications for Module. Now it looks like the template {{Error/sandbox}} passes all its template-space {{Error/testcases}} (which is just a limited set). - In Module:Error/testcases, I have added more tests (and grouped them). Also, all current tests are repeated for {{Error/sandbox}} because there seems to be an effect between UnitTest and /sandbox mode. UnitTest failed:
input "0" and "false" (probably the t/f logic is tricked)No, my typo in the testcases ;-) -DePiep (talk) 13:37, 4 April 2013 (UTC)- Input like {{Error}} (that is, no param1 at all) produces testcases:
{{{1}}} (vs.) Script error
. I guess this is because of the added check:or error('no message specified', 2)
in the module. The old template does not have this check. If this is not for debugging, that one could go? It should return{{{1}}}
I'd say. (See also the nowiki return texts: class "scribunto-error" was added).
- Adding: This could imply that there is only
message = arg[1]
to consider (plus a nil-check on that), since the message will only enter through param1. Template param Message is not the same asmodule param message. -DePiep (talk) 13:37, 4 April 2013 (UTC)
- Adding: This could imply that there is only
More fails I did not see. Hope I did help. -DePiep (talk) 13:27, 4 April 2013 (UTC)
- Some addings. -DePiep (talk) 13:37, 4 April 2013 (UTC)
- Thanks for your help here. The script errors in the module unit tests are fine, as the template will not trigger them (it will either show
{{{1}}}
or whitespace, depending on whether 1 is specified). They might be helpful for other modules that use this module, though, so I'm going to avoid actually programming in{{{1}}}
to the module code. :) It seemed like everything else was working, so I've updated the template. — Mr. Stradivarius ♪ talk ♪ 13:54, 4 April 2013 (UTC)- The error text stays hidden (instead, another error text is shown. ~btw, are errors listed (categorised) somewhere? -DePiep (talk) 14:57, 4 April 2013 (UTC)
- Note: again, the module still checks for these two arguments:
message = args.message or args[1] ...
while only one (unnamed param 1) exists. At the moment, there is no named parameter "message", so the module should not check for that one. -DePiep (talk) 14:02, 4 April 2013 (UTC)- Hmm, good point. Now that we've changed the invocation from Template:Error the message parameter isn't needed any more. I don't think having it there causes any harm though. Errors aren't tracked anywhere, no. Traditionally templates that want to track errors will include a tracking category straight after the {{error}} invocation, and the {{error}} template itself doesn't have anything to do with it. — Mr. Stradivarius ♪ talk ♪ 15:18, 4 April 2013 (UTC)
- Thanks for your help here. The script errors in the module unit tests are fine, as the template will not trigger them (it will either show