Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10293 closed enhancement (fixed)

Error conditions of WPDB unparseable by Code

Reported by: dd32's profile dd32 Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Administration Keywords: has-patch
Focuses: Cc:

Description (last modified by dd32)

I'm developing something which is making use of a new WPDB class, However, i've run into a slight issue with error handling.

I'd like to have the ability to tell what the error was while attempting to connect, without having to display the verbose text error to the user.

My thought is to store a error code in the WP_Error extra section, Or maybe change the 500 error code to be the default, unless something else is supplied..

See patch for the first thought, the 500 idea only just came to mind..


Theres a 2nd issue which is outlined in that patch, the Username in the select-db message may be incorrect for custom-connected DB's not using the DB_* constants.. see patch which stores the username in a class var..

Attachments (2)

10293.diff (2.7 KB) - added by dd32 15 years ago.
10293.2.diff (2.7 KB) - added by dd32 15 years ago.

Download all attachments as: .zip

Change History (7)

@dd32
15 years ago

#1 @dd32
15 years ago

  • Description modified (diff)

#2 @dd32
15 years ago

The other item is, It'd be nice to be able to get the error code/message for failed queries without resorting to mysql_* functions just in case someone has decided to abstract the DB layer... I may've completely missed a method for that though...

#3 @dd32
15 years ago

Any opinions from anyone on this?

@dd32
15 years ago

#4 @dd32
15 years ago

  • Keywords dev-feedback 2nd-opinion removed
  • Milestone changed from Future Release to 2.9

attachment 10293.2.diff added

The reason i'm suggesting this, Is because i'm using wp-db.php in another project: "WordPress Quick Install"(http://wpquickinstall.com/) I was hoping to be able to catch error conditionals from the database credentials page and mentioning that the database doesnt exist, not just "Theres an error with the input, try again"... While not reverting to using mysql_* based commands..

I can work around it however (Just include a modified file) but would like to see it change in WordPress.

#5 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11865]) Machine parseable db error codes. Props dd32. fixes #10293

Note: See TracTickets for help on using tickets.