Opened 17 years ago
Closed 17 years ago
#5263 closed defect (bug) (fixed)
Improved handling of profile-update errors
Reported by: |
|
Owned by: |
|
---|---|---|---|
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)
Change History (11)
#3
@
17 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
#4
follow-up:
↓ 5
@
17 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.)
#5
in reply to:
↑ 4
@
17 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.
#6
@
17 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?)
#7
@
17 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.
Patch handles errors gracefully