Exception: DeepL::Exceptions::ServerError

Inherits:
RequestError show all
Defined in:
lib/deepl/exceptions/server_error.rb

Direct Known Subclasses

DocumentNotReadyError

Instance Attribute Summary

Attributes inherited from RequestError

#request, #response

Attributes inherited from Error

#http_status_code

Instance Method Summary collapse

Constructor Details

#initialize(response, request = nil, should_retry: true) ⇒ ServerError

Returns a new instance of ServerError.

Parameters:

  • should_retry (Boolean) (defaults to: true) —

    False for a request that is unsafe to repeat once sent.



10
11
12
13
# File 'lib/deepl/exceptions/server_error.rb', line 10

def initialize(response, request = nil, should_retry: true)
  super(response, request)
  @should_retry = should_retry
end

Instance Method Details

#should_retry? ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/deepl/exceptions/server_error.rb', line 20

def should_retry?
  @should_retry
end

#to_s ⇒ Object



15
16
17
18
# File 'lib/deepl/exceptions/server_error.rb', line 15

def to_s
  with_body_message('An internal server error occured. ' \
                    'Try again after waiting a short period.')
end