User:Johnuniq/test
Resolved for now
[edit]All the weirdness mentioned in the "Error messages" section has gone away now that I have temporarily patched Module:Convert to use Module:Mwlocal instead of Module:Mw. I think some change in Scribunto must have created a global mw
variable, and there is some problem in the new code? And that caused the stuff below? Johnuniq (talk) 07:36, 13 February 2013 (UTC)
Error messages
[edit]The following conversions should give an error message as the result, but they should not give a "Script error".
- [convert: needs a number]
- 1.2[convert: needs unit name]
- 1.2 xyz[convert: unknown unit]
- 1.2 ftin[convert: unit invalid here]
Some results from various tests follow. I suspect these may not always occur as it may depend on some internal state of mw.lua or MediaWiki. I have definitely seen a "Script error" disappear (and stay disappeared after a browser refresh) when ?action=purge
was appended to URL).
*{{convert}} Script error *{{convert|1.2}} Conversion error: Need name of unit *{{convert|1.2|xyz|m}} Conversion error: Unit "xyz" is not known. *{{convert|1.2|ftin|m}} Conversion error: Unit "ftin" is invalid here.
Previewing following then gave these results:
*{{convert|1.2}} Script error *{{convert|1.2|xyz|m}} Conversion error: Unit "xyz" is not known. *{{convert|1.2|ftin|m}} Conversion error: Unit "ftin" is invalid here.
Previewing following then gave these results:
*{{convert|1.2|xyz|m}} Script error *{{convert|1.2|ftin|m}} Conversion error: Unit "ftin" is invalid here.
Previewing following then gave these results:
*{{convert|1.2|ftin|m}} Script error
Previewing following then gave these results:
*{{convert|1.2}} Script error
Previewing following then gave these results (all correct and as expected):
*{{convert|1.2|m|ftin}} 1.2 metres (3 ft 11 in) *{{convert}} Conversion error: Need value *{{convert|1.2}} Conversion error: Need name of unit *{{convert|1.2|xyz|m}} Conversion error: Unit "xyz" is not known. *{{convert|1.2|ftin|m}} Conversion error: Unit "ftin" is invalid here.
Conclusion: A bug somewhere requires the code in Module:Convert to run successfully once (without invoking Module:Mw) before a second erroneous template makes convert.lua uses mw.lua to report an error message.
Investigate problem using cutdown code
[edit]Following returns plain text if argument is "good", or an error message formatted by mw otherwise.
- [good][TWO]
- [bad][TWO]