-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Improve error messages for clarity #8177
base: trunk
Are you sure you want to change the base?
Improve error messages for clarity #8177
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some structural changes, but also some things that could be more appropriate to the WordPress context.
src/wp-admin/customize.php
Outdated
@@ -76,7 +76,7 @@ | |||
|
|||
if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) { | |||
wp_die( | |||
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . | |||
'<h1>' . __( 'An error occurred while saving your changeset. Please try again or start a new changeset.' ) . '</h1>' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep headings short - no more than one sentence, then add additional context as paragraphs below.
The heading should probably be "An error occurred while saving your changeset."
@@ -830,7 +830,7 @@ public function step_2() { | |||
|
|||
if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { | |||
wp_die( | |||
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . | |||
'<h1>' . __( 'An error occurred while processing your header image. Please ensure your theme supports custom headers and try again.' ) . '</h1>' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, just use the first sentence as the heading, then add additional context in paragraphs below.
@@ -1018,7 +1018,7 @@ public function step_3() { | |||
|
|||
if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { | |||
wp_die( | |||
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . | |||
'<h1>' . __( 'An error occurred while processing your header image. Please ensure your theme supports custom headers and try again.' ) . '</h1>' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue; use first sentence as heading, move second sentence to a paragraph below.
@@ -1029,7 +1029,7 @@ public function step_3() { | |||
&& ! current_theme_supports( 'custom-header', 'flex-width' ) | |||
) { | |||
wp_die( | |||
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . | |||
'<h1>' . __( 'An error occurred while processing your header image. Please ensure your theme supports custom headers and try again.' ) . '</h1>' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue; use first sentence as heading, move second sentence to a paragraph below.
src/wp-admin/media-upload.php
Outdated
@@ -35,7 +35,7 @@ | |||
// Require an ID for the edit screen. | |||
if ( isset( $action ) && 'edit' === $action && ! $ID ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName | |||
wp_die( | |||
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . | |||
'<h1>' . __( 'An error occurred during the upload process. Please try again or contact support.' ) . '</h1>' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no support to contact, and this error doesn't really give enough context for anybody to get a lot of value out of it by taking it to the support forums. I think eliminate 'or contact support', and move the additional sentence into the next paragraph.
src/wp-admin/users.php
Outdated
@@ -155,7 +155,7 @@ | |||
// If the user doesn't already belong to the blog, bail. | |||
if ( is_multisite() && ! is_user_member_of_blog( $id ) ) { | |||
wp_die( | |||
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . | |||
'<h1>' . __( 'An unexpected error occurred. Please try again or contact support.' ) . '</h1>' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the second sentence here.
@@ -5040,7 +5040,7 @@ public function blogger_getRecentPosts( $args ) { | |||
$posts_list = wp_get_recent_posts( $query ); | |||
|
|||
if ( ! $posts_list ) { | |||
$this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) ); | |||
$this->error = new IXR_Error( 500, __( 'No posts found or an error occurred while retrieving posts. Please try again later.' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think "please try again later" is appropriate here; that implies that this is known to be a temporary error, and we don't actually know that at this stage.
@@ -6523,7 +6523,7 @@ public function mt_getRecentPostTitles( $args ) { | |||
$posts_list = wp_get_recent_posts( $query ); | |||
|
|||
if ( ! $posts_list ) { | |||
$this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) ); | |||
$this->error = new IXR_Error( 500, __( 'No posts found or an error occurred while retrieving posts. Please try again later.' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "Please try again later."
src/wp-includes/script-loader.php
Outdated
@@ -810,7 +810,7 @@ function wp_default_scripts( $scripts ) { | |||
'wpAjax', | |||
array( | |||
'noPerm' => __( 'Sorry, you are not allowed to do that.' ), | |||
'broken' => __( 'Something went wrong.' ), | |||
'broken' => __( 'An unexpected error occurred while processing your request. Please try again later or contact support if the issue persists.' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "or contact support if the issue persists."
src/wp-includes/script-loader.php
Outdated
@@ -1292,7 +1292,7 @@ function wp_default_scripts( $scripts ) { | |||
'close' => __( 'Close' ), | |||
'action' => __( 'Action' ), | |||
'discardChanges' => __( 'Discard changes' ), | |||
'cheatin' => __( 'Something went wrong.' ), | |||
'cheatin' => __( 'An unexpected error occurred. Please check your permissions and try again.' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Permissions are not the only situation that can trigger 'cheatin', so that should probably not be implied. It's mostly about invalid nonce values.
Trac ticket: https://core.trac.wordpress.org/ticket/43622
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.