Exception: CIRunner::Client::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ci_runner/client/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_code, error_body, provider, message = nil) ⇒ Error

Returns a new instance of Error.

Parameters:

  • error_code (String)

    The HTTP status code.

  • error_body (String)

    The response from the provider.

  • provider (String)

    The name of the CI provider.

  • message (String, nil) (defaults to: nil)


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ci_runner/client/error.rb', line 12

def initialize(error_code, error_body, provider, message = nil)
  @error_code = error_code.to_i

  if message
    super(message)
  else
    super(<<~EOM.rstrip)
      Error while making a request to #{provider}. Code: #{error_code}

      The response was: #{error_body}
    EOM
  end
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



6
7
8
# File 'lib/ci_runner/client/error.rb', line 6

def error_code
  @error_code
end