Exception: BitBucket::Error::ServiceError

Inherits:
BitBucketError show all
Defined in:
lib/bitbucket_rest_api/error/service_error.rb

Direct Known Subclasses

BadRequest, NotFound

Instance Attribute Summary collapse

Attributes inherited from BitBucketError

#response_headers, #response_message

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ ServiceError

Returns a new instance of ServiceError.



8
9
10
11
# File 'lib/bitbucket_rest_api/error/service_error.rb', line 8

def initialize(env)
  super(generate_message(env))
  @http_headers = env[:response_headers]
end

Instance Attribute Details

#http_headersObject

Returns the value of attribute http_headers.



6
7
8
# File 'lib/bitbucket_rest_api/error/service_error.rb', line 6

def http_headers
  @http_headers
end

Instance Method Details

#generate_message(env) ⇒ Object



13
14
15
# File 'lib/bitbucket_rest_api/error/service_error.rb', line 13

def generate_message(env)
  "#{env[:method].to_s.upcase} #{env[:url]}: #{env[:status]} #{env[:body]}"
end