Page MenuHomePhabricator

Allow the user to see failed fragment renders with an error
Closed, ResolvedPublic

Description

Description

Better signal and identify Abstract Fragment render errors when shown in the Abstract Preview window, so that editors can understand the failure, and react.

abstractwiki_run_fragment can return a variety of errors:

  • generated at the abstract wiki side, while executing the API
  • generated at the wikifunctions side (php or orchestrator), while calling wikilambda_function_call

Errors can be php errors or Zerrors returned from the orchestrator.

Decide:

  • How to signal an error (currently cdx-message type=error
  • What is the message to show
  • How do we show error details (dialog? inline?)
  • What actions we enable for the user (refresh fragment?)

Devices and Design (URLs or screenshots)

  • Desktop: ...
  • Small screens/mobile: ...

Completion checklist

Event Timeline

gengh removed gengh as the assignee of this task.Feb 17 2026, 9:11 AM
gengh subscribed.

abstractwiki_run_fragment can return a variety of errors:

  1. generated at the abstract wiki side, while executing the API

The possible returned types are shown below.
Maybe we show the message from the response for 'bad-response', and 'wikilambda-zerror' the other 2 seem like it can be static.

const FRAGMENT_RENDER_ERROR_MAP = {
	'apierror-abstractwiki_run_fragment-not-enabled': { errorCode: 'not-enabled', useMessageAsDetails: false },
	'apierror-abstractwiki_run_fragment-bad-fragment': { errorCode: 'bad-fragment', useMessageAsDetails: false },
	'apierror-abstractwiki_run_fragment-bad-response': { errorCode: 'bad-response', useMessageAsDetails: true },
	'wikilambda-zerror': { errorCode: 'bad-response', useMessageAsDetails: true }
};

Possible Messages:

	"wikilambda-abstract-fragment-error-bad-fragment": "Could not render fragment: invalid fragment JSON.",
	"wikilambda-abstract-fragment-error-not-enabled": "Fragment preview is not available: this feature is not enabled.",
	"wikilambda-abstract-fragment-error-unknown": "Unable to render fragment.",

errors.js: Perhaps we can reuse the errors store for this as well and use the getFragmentCacheKey( keyPath, language ); cachekey as an errorId?

  1. generated at the wikifunctions side (php or orchestrator), while calling wikilambda_function_call

it would be nice if we could differentiate the 'apierror-abstractwiki_run_fragment-bad-response' errors a bit more in PHP:

  • apierror-abstractwiki_run_fragment-not-html-fragment: when response is not a z89 fragment
  • apierror-abstractwiki_run_fragment-invalid-json: when response is not valid json

And we should find a way to display orchestrator errors returned from this.

gengh changed the task status from Open to In Progress.Mar 3 2026, 2:51 PM

Change #1248016 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] [WIP] Remove risk to make local fetches when producing exceptions in clients

https://gerrit.wikimedia.org/r/1248016

Change #1248910 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] Use granular WikifunctionCallException for abstract wiki requests

https://gerrit.wikimedia.org/r/1248910

Change #1248910 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Use granular WikifunctionCallException for abstract wiki requests

https://gerrit.wikimedia.org/r/1248910