Exception: Azure::TTS::RequestError

Inherits:
Error
  • Object
show all
Defined in:
lib/azure/tts/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ RequestError

Returns a new instance of RequestError.



10
11
12
13
# File 'lib/azure/tts/errors.rb', line 10

def initialize(response)
  @response = response
  super(exception_message)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/azure/tts/errors.rb', line 8

def response
  @response
end

Instance Method Details

#exception_messageObject

rubocop:disable Metrics/AbcSize



15
16
17
18
19
20
21
22
23
24
# File 'lib/azure/tts/errors.rb', line 15

def exception_message # rubocop:disable Metrics/AbcSize
  format(
    "%<method>s request to %<url>s failed with status %<status>s (%<status_text>s). Response body: %<body>s",
    method: response.env.method.to_s.upcase,
    url: response.env.url.to_s,
    status: response.status,
    status_text: response.reason_phrase,
    body: response.body
  )
end