WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#5263 closed defect (bug) (fixed)

Improved handling of profile-update errors

Reported by: filosofo Owned by: pishmishy
Milestone: Priority: normal
Severity: normal Version: 2.3
Component: Administration Keywords: profile update has-patch developer-feedback
Focuses: Cc:

Description

Currently, errors when updating one's profile just echo and exit. My patch uses wp_die for that nice refined appearance.

Attachments (3)

profile_wp_die.patch (495 bytes) - added by filosofo 6 years ago.
5263.patch (1.1 KB) - added by pishmishy 6 years ago.
Patch handles errors gracefully
5263-combine.diff (3.0 KB) - added by DD32 6 years ago.
combine logic from profile-update.php into profile.php

Download all attachments as: .zip

Change History (11)

filosofo6 years ago

comment:1 Viper007Bond6 years ago

  • Keywords has-patch added

comment:2 Viper007Bond6 years ago

  • Component changed from General to Administration

comment:3 pishmishy6 years ago

  • Milestone changed from 2.3.2 to 2.4
  • Owner changed from anonymous to pishmishy
  • Status changed from new to assigned
  • Summary changed from Profile update fatal errors should use wp_die to Improved handling of profile-update errors
  • Type changed from defect to enhancement

pishmishy6 years ago

Patch handles errors gracefully

comment:4 follow-up: pishmishy6 years ago

  • Keywords developer-feedback added; wp_die removed

There's no reason to use wp_die(). This should be reserved for unrecoverable errors. User-friendly ways of handling errors should be used when possible.

My attached patch passes the error back to profile.php to be displayed in a fading box. This should help other proposed changes such as #5404.

(Note: I'm not entirely happy with passing the error back through the options table. I'm open to suggestions if a better way can be shown.)

comment:5 in reply to: ↑ 4 filosofo6 years ago

  • Type changed from enhancement to defect

Replying to pishmishy:

There's no reason to use wp_die(). This should be reserved for unrecoverable errors. User-friendly ways of handling errors should be used when possible.

Hello pishmishy,

Thanks for your contribution. You are probably right that there are better ways of handling errors in WP. However, my patch simply fixes a bug and brings the code into line with standard WP practice in handling errors.

Your enhancement of temporarily saving error messages in the options table doesn't have much chance of being accepted by the commit devs, because it's such a radical change on a trivial patch and because of obvious problems (e.g. two users generating errors at approximately the same time will overwrite each other's messages).

A new error-handing system sounds like a great idea for a new ticket.

comment:6 DD326 years ago

I'll agree that saving in the options table isnt exactly nice..

But i'm also agree that simply dieing on the error doesnt seem nice either.

In keeping with WP's usual method of displaying the error at the top of the page, I'm including a patch to remove profile-update.php all together and combining it into a single file. Nothing else seems to use the file (allthough some 3rd party app's might choose to use it? dunno?)

DD326 years ago

combine logic from profile-update.php into profile.php

comment:7 pishmishy6 years ago

It's also possible to do this in profile-update.php

if ( is_wp_error( $errors ) ) {
        include_once('profile.php');
        exit;
}

Then the $error object becomes available to profile.php. The other admin pages don't use a seperate -update.php file so perhaps DD32 has shown the right way to go.

comment:8 pishmishy6 years ago

  • Milestone 2.6 deleted
  • Resolution set to fixed
  • Status changed from assigned to closed

This bug no longer occurs in the trunk code and the new administration panels.

Note: See TracTickets for help on using tickets.