-
Notifications
You must be signed in to change notification settings - Fork 92
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
Changed error handling #384
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I like this, nice improvement. Some comments.
@@ -229,7 +229,7 @@ public function render_basic_description() { | |||
public function auth0_delete_cache_transient() { | |||
if ( ! is_admin() ) return; | |||
|
|||
WP_Auth0_ErrorManager::insert_auth0_error( 'WP_Auth0_Admin_Basic::delete_cache_transient', 'deleting cache transient' ); | |||
WP_Auth0_ErrorManager::insert_auth0_error( __METHOD__, 'deleting cache transient' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must be missing something here, it seems like it will just log this error every time and then it calls the method to delete cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like it's there as a message rather than an error. I've never had a use for it (or seen it in the logs) but I'm guessing it's there for a reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well should be a general log vs error. However that can be a story for another day.
@@ -425,7 +425,7 @@ public function get_auth0_users( $user_ids = null ) { | |||
$results = get_users( $query ); | |||
|
|||
if ( $results instanceof WP_Error ) { | |||
WP_Auth0_ErrorManager::insert_auth0_error( 'findAuth0User', $userRow ); | |||
WP_Auth0_ErrorManager::insert_auth0_error( __METHOD__, $results->get_error_message() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presume $results->get_error_message()
is more useful than $userRow
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$userRow
was never defined here
lib/WP_Auth0_Routes.php
Outdated
@@ -204,7 +204,7 @@ protected function migration_ws_get_user() { | |||
} | |||
|
|||
if ($user instanceof WP_Error) { | |||
WP_Auth0_ErrorManager::insert_auth0_error( 'migration_ws_get_user', $user ); | |||
WP_Auth0_ErrorManager::insert_auth0_error( __METHOD__, $user ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other places https://github.com/auth0/wp-auth0/pull/384/files#diff-277e60f8ce82a93a9c30ed5aa4c01dd9R189
You will show the name of the method called but not in this one e.g. get_user_by
, does it have a get_error_message
also available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cocojoe - Actually ... that function looks for a WP_Error
object and handles nicely:
https://github.com/auth0/wp-auth0/blob/master/lib/WP_Auth0_ErrorManager.php#L7
f6cfbd8
to
ef33f47
Compare
ef33f47
to
13fa458
Compare
@@ -229,7 +229,7 @@ public function render_basic_description() { | |||
public function auth0_delete_cache_transient() { | |||
if ( ! is_admin() ) return; | |||
|
|||
WP_Auth0_ErrorManager::insert_auth0_error( 'WP_Auth0_Admin_Basic::delete_cache_transient', 'deleting cache transient' ); | |||
WP_Auth0_ErrorManager::insert_auth0_error( __METHOD__, 'deleting cache transient' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well should be a general log vs error. However that can be a story for another day.
@cocojoe - Totally agree on the log verbiage. I have a few ideas to improve in a way that can be re-used on the re-write. TY! |
__METHOD__
magic constant instead of hard-coded method name