diff --git a/lib/duse/cli/api_command.rb b/lib/duse/cli/api_command.rb
index <HASH>..<HASH> 100644
--- a/lib/duse/cli/api_command.rb
+++ b/lib/duse/cli/api_command.rb
@@ -15,6 +15,8 @@ module Duse
         rescue JSON::ParserError => e
           error 'Parsing error'
         end
+      rescue Duse::Client::NotLoggedIn
+        error "not logged in, run `#$0 login`"
       rescue Duse::Client::Error => e
         error e.message
       rescue Interrupt
@@ -24,11 +26,11 @@ module Duse
       private
 
       def ensure_uri_is_set
-        error 'not configured, please run "duse config"' if config.uri.nil?
+        error "client not configured, run `#$0 config`" if config.uri.nil?
       end
 
       def authenticate
-        error 'not logged in, please run "duse login"' if config.token.nil?
+        fail Duse::Client::NotLoggedIn if config.token.nil?
         Duse.session = Duse::Client::Session.new(
           uri:   config.uri,
           token: config.token
better not logged in handling and error messages