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

Improve error messages for clarity #8177

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-admin/customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>' .
'<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
403
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/includes/class-custom-image-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>' .
'<p>' . __( 'The active theme does not support uploading a custom header image.' ) . '</p>',
403
);
Expand Down Expand Up @@ -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>' .
'<p>' . __( 'The active theme does not support uploading a custom header image.' ) . '</p>',
403
);
Expand All @@ -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>' .
'<p>' . __( 'The active theme does not support a flexible sized header image.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ function wp_edit_theme_plugin_file( $args ) {
wp_opcache_invalidate( $real_file, true );

if ( ! isset( $result['message'] ) ) {
$message = __( 'Something went wrong.' );
$message = __( 'An unexpected error occurred. Please try again later or contact support.' );
} else {
$message = $result['message'];
unset( $result['message'] );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/revision.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ function wp_print_revision_templates() {

<script id="tmpl-revisions-diff" type="text/html">
<div class="loading-indicator"><span class="spinner"></span></div>
<div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
<div class="diff-error"><?php _e( 'An error occurred while loading the comparison. Please refresh the page and try again.' ); ?></div>
<div class="diff">
<# _.each( data.fields, function( field ) { #>
<h2>{{ field.name }}</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/media-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>' .
'<p>' . __( 'Invalid item ID.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/network/site-users.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
// If the user doesn't already belong to the blog, bail.
if ( ! is_user_member_of_blog( $user_id ) ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<h1>' . __( 'An unexpected error occurred. Please try again or contact support.' ) . '</h1>' .
'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

if ( ! $theme->exists() || ! $theme->is_allowed() ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<h1>' . __( 'An unexpected error occurred. Please try again or contact support.' ) . '</h1>' .
'<p>' . __( 'The requested theme does not exist.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>' .
'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ protected function wp_die( $ajax_message, $message = null ) {
}

if ( ! $message ) {
$message = __( 'Something went wrong.' );
$message = __( 'An unexpected error occurred while customizing. Please refresh the page and try again.' );
}

if ( $this->messenger_channel ) {
Expand Down
6 changes: 3 additions & 3 deletions src/wp-includes/class-wp-xmlrpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -4020,7 +4020,7 @@ public function wp_newComment( $args ) {
}

if ( ! $comment_id ) {
return new IXR_Error( 403, __( 'Something went wrong.' ) );
return new IXR_Error( 403, __( 'An error occurred while processing your comment. Please ensure all fields are filled correctly and try again.' ) );
}

/**
Expand Down Expand Up @@ -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.' ) );
return $this->error;
}

Expand Down Expand Up @@ -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.' ) );
return $this->error;
}

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3672,7 +3672,7 @@ function get_allowed_mime_types( $user = null ) {
*/
function wp_nonce_ays( $action ) {
// Default title and response code.
$title = __( 'Something went wrong.' );
$title = __( 'An unexpected error occurred. Please try again later.' );
$response_code = 403;

if ( 'log-out' === $action ) {
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.' ),
)
);

Expand Down Expand Up @@ -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.' ),
'notAllowedHeading' => __( 'You need a higher level of permission.' ),
'notAllowed' => __( 'Sorry, you are not allowed to customize this site.' ),
'previewIframeTitle' => __( 'Site Preview' ),
Expand Down
2 changes: 1 addition & 1 deletion src/wp-mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
$last_checked = get_transient( 'mailserver_last_checked' );

if ( $last_checked ) {
wp_die( __( 'Slow down cowboy, no need to check for new mails so often!' ) );
wp_die( __( 'Please wait a moment before checking for new emails again.' ) );
}

set_transient( 'mailserver_last_checked', true, WP_MAIL_INTERVAL );
Expand Down
Loading