Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using REST API data for database errors. #64158

Open
peterwilsoncc opened this issue Aug 1, 2024 · 4 comments · May be fixed by #68360
Open

Consider using REST API data for database errors. #64158

peterwilsoncc opened this issue Aug 1, 2024 · 4 comments · May be fixed by #68360
Assignees
Labels
[Package] Editor /packages/editor [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@peterwilsoncc
Copy link
Contributor

What problem does this address?

Currently saving errors in the database show the generic error message: Updating failed. Could not update post in the database.

Screenshot 2024-08-01 at 2 08 30 PM

While the message explains what happened, it provides no indication of how the user can fix it.

What is your proposed solution?

The REST API response includes further details about the field or fields that caused the error: WordPress database error: Processing the value for the following field failed: %s. The supplied value may be too long or contains invalid data.

{
	"code": "db_update_error",
	"message": "Could not update post in the database.",
	"data": {
		"status": 500
	},
	"additional_data": [
		"WordPress database error: Processing the value for the following field failed: post_password. The supplied value may be too long or contains invalid data."
	]
}

Using the additional data could be helpful in providing users with an indication of why the database error occurred.

While the main portion of the content is translated, the field or fields that caused the error to occur are not (all sites use English for the database table names). So it's possible some work would need to be done to make the error messages more useful for non-English sites.

Props @ramonjd for the suggestion in #64155

@hanneslsm
Copy link

Yes please, that'd be a big UX improvement!
Could potentially solve #53095 and similar issues. We'd probably need to go through the copy in future but making it technically possible to provide more info would be a big win already.

@Mamaduka
Copy link
Member

I think the main blocker here is design. Notices need a way to display primary and secondary message texts.

Something that needs to be considered in #67662. @jasmussen, @jameskoster

@jasmussen
Copy link
Contributor

I do appreciate that these need a clearer and more coherent design as part of 67662, but it's not clear that this needs to block this effort. Notices already exist in the editor, so the component is shipping and can be used. How we update and improve that component is mainly what the effort tracks. The nuance may be in deciding the functionality: dismissible or not, etc. But that may still not be blocking, if the feature if the component is already in use. But let me know if I missed anything else!

@Mamaduka
Copy link
Member

Thanks for the feedback, @jasmussen!

Makes sense; we can update the notice message to include the additional error data. Then, the design will be improved when new notice styles ship.

Here's what it would look like when all messages are combined into a single string.

Image

@Mamaduka Mamaduka self-assigned this Dec 27, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Editor /packages/editor [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants