Sha256: e6d83392a477a4da166e1e689bb15fe8dde17795fd857d1bdb942ca5dc4ed251

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

module Azure
  module TTS
    class Error < StandardError; end

    class RequestError < Error
      attr_reader :response

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

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
azure-tts-1.0.0 lib/azure/tts/errors.rb