[buddypress-trac] [BuddyPress Trac] #6535: Entering an invalid username when composing a message shows generic error
buddypress-trac
noreply at wordpress.org
Thu Oct 15 03:37:10 UTC 2015
#6535: Entering an invalid username when composing a message shows generic error
-------------------------------------+------------------
Reporter: r-a-y | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.4
Component: Component - Messaging | Version: 1.0
Severity: normal | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+------------------
Comment (by boonebgorges):
I think returning `WP_Error` messages for this kind of thing is generally
a good thing. It stinks that we have to introduce this lame `$error_type`
parameter :(
As for the question of whether `BP_Messages_Message::send()` should return
`WP_Error` messages too: If we were building these systems from scratch,
I'd probably lean yes. But given that all of our database-access methods
tend to return `false` on failure, it'd be a large undertaking to fix
them. Better, I think, would be to move business logic out of low-level
functions like `send()` and into the controllers like
`messages_new_message()`. For example, is there a reason why an `if (
empty( $this->recipients ) )` clause belongs in the database access
method? At a database level, there's nothing wrong with a message without
recipients; it's only further up in the application that it's a problem.
And when something goes wrong in one of these methods that is legitimately
database-related - like a failed `$wpdb->query()` - `$wpdb` doesn't give
us enough information to build an error object anyway.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6535#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list