lib/client.rb in navi_client-1.2.9 vs lib/client.rb in navi_client-1.3.0
- old
+ new
@@ -15,10 +15,14 @@
module Client
def logger
@logger
end
+ def errors
+ @errors
+ end
+
#
# imap_connection
#
# connect the app with imap server
#
@@ -39,11 +43,18 @@
imap.disconnect
exit
end
end
- # login
- imap.login username, password
+ begin
+ # login
+ imap.login username, password
+ rescue Net::IMAP::NoResponseError => e
+ # mostly due to credentials error
+ @errors = {exception: e}
+ rescue Net::IMAP::BadResponseError => e
+ @errors = {exception: e}
+ end
# return IMAP connection handler
imap
end