Misplaced Pages

Module talk:Data: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 11:22, 17 January 2021 editMSGJ (talk | contribs)Autopatrolled, Administrators131,138 edits Request: re, thanks← Previous edit Revision as of 17:01, 17 January 2021 edit undoJackmcbarn (talk | contribs)31,380 edits reNext edit →
Line 7: Line 7:
:::{{ping|MSGJ}} I see. It's because <code>table.concat</code> doesn't respect metamethods. Fixed now. ] (]) 19:04, 16 January 2021 (UTC) :::{{ping|MSGJ}} I see. It's because <code>table.concat</code> doesn't respect metamethods. Fixed now. ] (]) 19:04, 16 January 2021 (UTC)
::::That's great ], thanks! Do we actually need two different ways to display the error, or could the softfail be used for all? &mdash;&nbsp;Martin <small>(]&nbsp;·&nbsp;])</small> 11:22, 17 January 2021 (UTC) ::::That's great ], thanks! Do we actually need two different ways to display the error, or could the softfail be used for all? &mdash;&nbsp;Martin <small>(]&nbsp;·&nbsp;])</small> 11:22, 17 January 2021 (UTC)
:::::{{ping|MSGJ}} I intend for <code>softfail</code> to mean "I know this might fail and I'm going to handle it if it does". If softfail were the default, it would be easy for a lookup to fail in a template where the author didn't expect it, but also in such a way that no tracking category gets added (e.g., inside the condition of a #if). The tracking category from a script error is "stickier", so it being the default means that any coding mistakes will for sure result in a categorization so we can find and fix them. ] (]) 17:00, 17 January 2021 (UTC)

Revision as of 17:01, 17 January 2021

Request

@Jackmcbarn: I know you're not too active at the moment, but I have a request. Would it be possible to update the code so that it will fail gracefully (without script errors) if key1 does not exist in the data module? At the moment I have no way to see if a value is defined without causing the script error. Thanks and hope to see you back soon! — Martin (MSGJ · talk) 22:24, 14 January 2021 (UTC)

@MSGJ: Done. Add |softfail= to the invocation you want this for. Jackmcbarn (talk) 00:35, 15 January 2021 (UTC)
Sorry it's not working yet. — Martin (MSGJ · talk) 10:14, 15 January 2021 (UTC)

{{#invoke:Data|Module:Data/Bridge config|Q1234|c1|softfail=y}} -> Lua error in package.lua at line 80: module 'Module:Data/Bridge config' not found.

@MSGJ: I see. It's because table.concat doesn't respect metamethods. Fixed now. Jackmcbarn (talk) 19:04, 16 January 2021 (UTC)
That's great Jackmcbarn, thanks! Do we actually need two different ways to display the error, or could the softfail be used for all? — Martin (MSGJ · talk) 11:22, 17 January 2021 (UTC)
@MSGJ: I intend for softfail to mean "I know this might fail and I'm going to handle it if it does". If softfail were the default, it would be easy for a lookup to fail in a template where the author didn't expect it, but also in such a way that no tracking category gets added (e.g., inside the condition of a #if). The tracking category from a script error is "stickier", so it being the default means that any coding mistakes will for sure result in a categorization so we can find and fix them. Jackmcbarn (talk) 17:00, 17 January 2021 (UTC)