Exception: MLBStatsAPI::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/mlb_stats_api/errors.rb

Direct Known Subclasses

ForbiddenError, NotFoundError, UnauthorizedError

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
# File 'lib/mlb_stats_api/errors.rb', line 5

def initialize(response)
  super()

  @response = response
end

Instance Method Details

#to_sObject



11
12
13
14
15
16
17
18
19
# File 'lib/mlb_stats_api/errors.rb', line 11

def to_s
  # @response.response
  format(
    '%<code>s: %<message>s (%<uri>s)',
    code: @response.code,
    message: '',
    uri: @response.request.last_uri.to_s
  )
end