Module: DeepL::Requests::Base::ResponseFormatGuard
- Defined in:
- lib/deepl/requests/base.rb
Overview
Wraps request of every request class, so that a malformed response raises a
DeepL::Exceptions::Error instead of a raw JSON or type error.
Instance Method Summary collapse
Instance Method Details
#request ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/deepl/requests/base.rb', line 41 def request super rescue *RESPONSE_FORMAT_ERRORS => e raise e unless @response_received raise Exceptions::Error, "Unexpected response from the DeepL API: #{e.}" end |