Skip to content
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

Merged
merged 2 commits into from
Jan 31, 2018
Merged

Changed error handling #384

merged 2 commits into from
Jan 31, 2018

Conversation

joshcanhelp
Copy link
Contributor

@joshcanhelp joshcanhelp added this to the v3-Next milestone Jan 29, 2018
Copy link
Member

@cocojoe cocojoe left a 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' );
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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() );
Copy link
Member

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 ?

Copy link
Contributor Author

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

@@ -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 );
Copy link
Member

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?

Copy link
Contributor Author

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

@@ -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' );
Copy link
Member

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.

@joshcanhelp
Copy link
Contributor Author

@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!

@joshcanhelp joshcanhelp merged commit 37a128a into dev Jan 31, 2018
@joshcanhelp joshcanhelp deleted the changed-error-handling branch January 31, 2018 17:28
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants