Sha256: 58314d9f2cf3592d343ebf70da1e7403cba2198d8ee127998c57264667d6836c
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
module Flucti module Utilities module ConnectionErrorHandling def self.included(target) target.module_eval do alias_method_chain :request, 'exception_handling' end end def request_with_exception_handling(*args, &block) request_without_exception_handling(*args, &block) rescue => e Handler.handle(e) or raise e end module Handler extend self, Utilities 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 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Flucti-flucti-cli-0.1.16 | lib/flucti/utilities/connection_error_handling.rb |