Class: EmailSettingsExceptionHandler::GenericProvider

Inherits:
Object
  • Object
show all
Defined in:
app/services/email_settings_exception_handler.rb

Direct Known Subclasses

GmailProvider

Instance Method Summary collapse

Constructor Details

#initialize(exception) ⇒ GenericProvider

Returns a new instance of GenericProvider.



24
25
26
# File 'app/services/email_settings_exception_handler.rb', line 24

def initialize(exception)
  @exception = exception
end

Instance Method Details

#messageObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/services/email_settings_exception_handler.rb', line 28

def message
  case @exception
  when Net::POPAuthenticationError
    net_pop_authentication_error
  when Net::IMAP::NoResponseError
    net_imap_no_response_error
  when Net::IMAP::Error
    net_imap_unhandled_error
  when Net::SMTPAuthenticationError
    net_smtp_authentication_error
  when Net::SMTPServerBusy
    net_smtp_server_busy
  when Net::SMTPSyntaxError, Net::SMTPFatalError, Net::SMTPUnknownError
    net_smtp_unhandled_error
  when SocketError, Errno::ECONNREFUSED
    socket_connection_error
  when Net::OpenTimeout, Net::ReadTimeout
    net_timeout_error
  else
    unhandled_error
  end
end