diff --git a/bin/aptible b/bin/aptible index 3c0b22a0..f122d944 100755 --- a/bin/aptible +++ b/bin/aptible @@ -10,7 +10,7 @@ end begin Aptible::CLI::Agent.start rescue HyperResource::ClientError => e - m = if e.body['error'] == 'invalid_token' + m = if %w(invalid_token expired_token).include? e.body['error'] 'API authentication error: please run aptible login' else "An error occurred: #{e.body['message']}" diff --git a/lib/aptible/cli/agent.rb b/lib/aptible/cli/agent.rb index bdc3e24b..f604347e 100644 --- a/lib/aptible/cli/agent.rb +++ b/lib/aptible/cli/agent.rb @@ -235,11 +235,7 @@ def nag_toolbelt def warn_sso_enforcement # If the user is also a member of - begin - token = fetch_token - rescue StandardError - return - end + token = fetch_token reauth = Aptible::Auth::ReauthenticateOrganization.all(token: token) return if reauth.empty? @@ -247,6 +243,7 @@ def warn_sso_enforcement 'login method (SSO or Aptible credentials) to access', 'these organizations:', reauth.map(&:name)].join(' ')) + rescue StandardError end def version_string diff --git a/lib/aptible/cli/version.rb b/lib/aptible/cli/version.rb index b143f764..33714c26 100644 --- a/lib/aptible/cli/version.rb +++ b/lib/aptible/cli/version.rb @@ -1,5 +1,5 @@ module Aptible module CLI - VERSION = '0.16.8'.freeze + VERSION = '0.16.9'.freeze end end