From a09df25eb74f4779c047a43b044e4ab2604aa95c Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Tue, 13 Aug 2024 10:15:43 -0600 Subject: [PATCH] fix: Use NoMethodError instead of NotImplementedError for unimplemented base class methods (#487) --- lib/googleauth/base_client.rb | 6 +++--- lib/googleauth/external_account/base_credentials.rb | 2 +- lib/googleauth/token_store.rb | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/googleauth/base_client.rb b/lib/googleauth/base_client.rb index 8ac47c1a..52a1dba2 100644 --- a/lib/googleauth/base_client.rb +++ b/lib/googleauth/base_client.rb @@ -63,17 +63,17 @@ def notify_refresh_listeners end def expires_within? - raise NotImplementedError + raise NoMethodError, "expires_within? not implemented" end private def token_type - raise NotImplementedError + raise NoMethodError, "token_type not implemented" end def fetch_access_token! - raise NotImplementedError + raise NoMethodError, "fetch_access_token! not implemented" end end end diff --git a/lib/googleauth/external_account/base_credentials.rb b/lib/googleauth/external_account/base_credentials.rb index a1c0ffe2..80663d73 100644 --- a/lib/googleauth/external_account/base_credentials.rb +++ b/lib/googleauth/external_account/base_credentials.rb @@ -76,7 +76,7 @@ def fetch_access_token! _options = {} # The retrieved subject token. # def retrieve_subject_token! - raise NotImplementedError + raise NoMethodError, "retrieve_subject_token! not implemented" end # Returns whether the credentials represent a workforce pool (True) or diff --git a/lib/googleauth/token_store.rb b/lib/googleauth/token_store.rb index 8ee368ff..e70b30c6 100644 --- a/lib/googleauth/token_store.rb +++ b/lib/googleauth/token_store.rb @@ -29,7 +29,7 @@ class << self # @return [String] # The loaded token data. def load _id - raise "Not implemented" + raise NoMethodError, "load not implemented" end # Put the token data into storage for the given ID. @@ -39,7 +39,7 @@ def load _id # @param [String] token # The token data to store. def store _id, _token - raise "Not implemented" + raise NoMethodError, "store not implemented" end # Remove the token data from storage for the given ID. @@ -47,7 +47,7 @@ def store _id, _token # @param [String] id # ID of the token data to delete def delete _id - raise "Not implemented" + raise NoMethodError, "delete not implemented" end end end