Content deleted Content added
→Redirects: I've looked up how to be pretty |
→Output for invalid input: Reply |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 23:
</syntaxhighlight>
::[[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 03:58, 26 February 2022 (UTC)
:::@[[User:Johnuniq|Johnuniq]] Looks good. I simplified the code a little further, and will run some more tests before taking it live. --[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<span style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:-.3em;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</span>]]) 05:28, 26 February 2022 (UTC)
::::My tests on [[Module talk:ResolveEntityId/testcases]] are all working correctly. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 16:44, 27 February 2022 (UTC)
::::Ahecht: Do you think this is ready to deploy? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 10:34, 2 March 2022 (UTC)
I don't have an opportunity to fully investigate at the moment but [[Cobble skink]] is showing "Lua error in Module:ResolveEntityId at line 32: attempt to index a nil value" at the bottom due to a recent edit here. Perhaps it's a problem in that article that someone could fix, although the module should show a better message. Every function related to titles or wikidata will potentially return nil or give some other error at some point. It's a shame that code has to be uglified but the fix there would be something like "local title = mw.title.new(...) or error('helpful text here')" then use title.redirectTarget. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 23:13, 7 March 2022 (UTC)
:It was caused by an empty definition of from1, i.e.
<pre>{{Taxonbar|from1=|from2=Q106918135}}</pre>
:[[Module:Taxonbar]] or this module need to be made more robust so that a blank input does not cause an error — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 18:02, 8 March 2022 (UTC)
== Output for invalid input ==
Could the module be made a bit more robust? If something invalid is passed to the template, e.g.
<pre>{{#invoke:ResolveEntityId|entityid|[[Kouga Dam]]}}</pre>
could it fail gracefully by returning nil? At the moment we are getting "Lua error in Module:ResolveEntityId at line 32: attempt to index a nil value". Cheers — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:25, 2 November 2022 (UTC)
:Since I realised I had already requested this previously, I went ahead and made the corrections to the module. Hope there are no side-effects but testcases are working fine. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 15:34, 2 November 2022 (UTC)
|