Exception: Cloudflair::CloudflareError
- Inherits:
-
StandardError
- Object
- StandardError
- Cloudflair::CloudflareError
- Defined in:
- lib/cloudflair/error/cloudflare_error.rb
Instance Attribute Summary collapse
-
#cloudflare_errors ⇒ Object
readonly
Returns the value of attribute cloudflare_errors.
Instance Method Summary collapse
-
#initialize(cloudflare_errors) ⇒ CloudflareError
constructor
A new instance of CloudflareError.
- #to_s ⇒ Object
Constructor Details
#initialize(cloudflare_errors) ⇒ CloudflareError
Returns a new instance of CloudflareError.
7 8 9 10 11 |
# File 'lib/cloudflair/error/cloudflare_error.rb', line 7 def initialize(cloudflare_errors) @cloudflare_errors = cloudflare_errors super(to_s) end |
Instance Attribute Details
#cloudflare_errors ⇒ Object (readonly)
Returns the value of attribute cloudflare_errors.
5 6 7 |
# File 'lib/cloudflair/error/cloudflare_error.rb', line 5 def cloudflare_errors @cloudflare_errors end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/cloudflair/error/cloudflare_error.rb', line 13 def to_s if cloudflare_errors.empty? '[ "An error happened, but no error message/code was given by CloudFlare." (Code: 0000) ]' else strings = cloudflare_errors.map { |error| "\"#{error['message']}\" (Code: #{error['code']})" } "[ #{strings.join ', '} ]" end end |