Page MenuHomePhabricator

PublishDialog: Show better errors when returned Z509/List of errors
Closed, ResolvedPublicBUG REPORT

Description

Description

When returning an error from creation/edition, the front end Publish Dialog does its best to show the most relevant string that identifies the error.

However, with some errors, the persistence layer returns Z509/List of errors, which wraps a typed list of Z5 with the different encountered errors.

In such cases, the Publish Dialog is showing "list of errors" instead of showing a list of the error messages.

Steps to reproduce:

    1. Go to create function page: https://wikifunctions.beta.wmflabs.org/w/index.php?title=Special:CreateObject&zid=Z8
    2. To force this behavior, create a function with clashing labels. For example create a function that has the same names as https://wikifunctions.beta.wmflabs.org/wiki/Z10014
      • English - "And"
      • Swedish - "Och"
  1. Click "Publish" and proceed to the final publish step:

Observed behavior:

  • Publishing returns the following error:

Screenshot from 2023-09-04 13-04-33.png (454×649 px, 37 KB)

  • However, the returned object can be inspected on the browser "Network" details:
{
	"error": {
		"code": "wikilambda-zerror",
		"info": "Error of type Z509",
		"message": "List of errors",
		"zerror": {
			"Z1K1": "Z5",
			"Z5K1": "Z509",
			"Z5K2": {
				"Z1K1": {
					"Z1K1": "Z7",
					"Z7K1": "Z885",
					"Z885K1": "Z509"
				},
				"K1": ["Z5", {
					"Z1K1": "Z5",
					"Z5K1": "Z554",
					"Z5K2": {
						"Z1K1": {
							"Z1K1": "Z7",
							"Z7K1": "Z885",
							"Z885K1": "Z554"
						},
						"K1": {
							"Z1K1": "Z6",
							"Z6K1": "Z10014"
						},
						"K2": {
							"Z1K1": "Z6",
							"Z6K1": "Z1002"
						}
					}
				}, {
					"Z1K1": "Z5",
					"Z5K1": "Z554",
					"Z5K2": {
						"Z1K1": {
							"Z1K1": "Z7",
							"Z7K1": "Z885",
							"Z885K1": "Z554"
						},
						"K1": {
							"Z1K1": "Z6",
							"Z6K1": "Z10014"
						},
						"K2": {
							"Z1K1": "Z6",
							"Z6K1": "Z1592"
						}
					}
				}]
			}
		},
		"labelled": {
			"type": "Error",
			"error type": "List of errors",
			"error value": {
				"type": {
					"type": "Function call",
					"function": "Errortype to type",
					"errortype": "List of errors"
				},
				"errors": ["Error", {
					"type": "Error",
					"error type": "Label for a given language clashes with another Object's label",
					"error value": {
						"type": {
							"type": "Function call",
							"function": "Errortype to type",
							"errortype": "Label for a given language clashes with another Object's label"
						},
						"clashing ZID": {
							"type": "String",
							"value": "And"
						},
						"language": {
							"type": "String",
							"value": "English"
						}
					}
				}, {
					"type": "Error",
					"error type": "Label for a given language clashes with another Object's label",
					"error value": {
						"type": {
							"type": "Function call",
							"function": "Errortype to type",
							"errortype": "Label for a given language clashes with another Object's label"
						},
						"clashing ZID": {
							"type": "String",
							"value": "And"
						},
						"language": {
							"type": "String",
							"value": "Swedish"
						}
					}
				}]
			}
		},
		"*": "See https://wikifunctions.beta.wmflabs.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."
	},
	"servedby": "deployment-mediawiki11"
}

The list of errors inside "Z509" clearly shows two errors with significant information:

  • Label for a given language clashes with another Object's label (chashing ZID: And, language: Swedish)
  • Label for a given language clashes with another Object's label (chashing ZID: And, language: English)

It would be much more informative if such error rendered this simple message, which can at least transmit that there are 2 errors, and that the errors are label clashes:

Screenshot from 2023-09-04 13-13-22.png (545×615 px, 57 KB)


Completion checklist

Event Timeline

Jdforrester-WMF moved this task from To triage to Backlog on the Abstract Wikipedia team board.

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

[mediawiki/extensions/WikiLambda@master] [WIP] Return main error message and complete error message HTML separately

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

Change #1017106 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Return main error message and complete error message HTML separately

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

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

[mediawiki/extensions/WikiLambda@master] Instead of child errors, show labelized key for "Z526/Key value not wellformed" error

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

Change #1018277 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Add labelized key for "Z526/Key value not wellformed" error

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