Module: Flucti::Utilities::ConnectionErrorHandling::Handler

Extended by:
Flucti::Utilities, Handler
Included in:
Handler
Defined in:
lib/flucti/utilities/connection_error_handling.rb

Constant Summary

Constants included from Flucti::Utilities

SUPPORT_EMAIL_ADDR

Constants included from Miscellaneous

Miscellaneous::BOGUS_ERROR_MESSAGES

Instance Method Summary collapse

Methods included from Miscellaneous

#clean_name, #command, #error!, #sh, #try_save

Methods included from TaskPacking

#import_pack

Methods included from UserInterface

#confirm, #puts_list, #puts_long, #puts_subtitle, #puts_title, #qcommand, #quote, #terminal_width

Instance Method Details

#handle(err) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/flucti/utilities/connection_error_handling.rb', line 19

def handle(err)
  case err
  when WebService::BadGateway
    error! <<-MSG
      The VPS you attempted to perform an action on returned an error.
      It may be out of memory or disk space. Try running
      #{qcommand 'vps:run CMD="vmstat -s -S M"'} and
      #{qcommand 'vps:run CMD="df -h"'} respectively to determine
      whether it's the case or not.
    MSG
  when WebService::ServiceUnavailable, WebService::TimeoutError, Errno::ECONNREFUSED
    error! <<-MSG
      It looks like we are currently performing maintenance on our
      servers. Please retry later.
    MSG
  when WebService::GatewayTimeout
    error! <<-MSG
      The VPS you attempted to perform an action on did not respond in
      time. Please check its system load averages and retry.
    MSG
  when WebService::ServerError
    error! <<-MSG
      An error occurred while processing your request. We have be
      notified about this error and will work on fixing it. We
      apologize for the inconvenience. Please retry later.
    MSG
  end
end