Exception: DeepL::Exceptions::DocumentTranslationError

Inherits:
Error
  • Object
show all
Defined in:
lib/deepl/exceptions/document_translation_error.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#http_status_code

Instance Method Summary collapse

Constructor Details

#initialize(message, handle, error = nil) ⇒ DocumentTranslationError

error is the failure being wrapped; the HTTP status and retryability of a DeepL error are copied from it.



15
16
17
18
19
20
21
22
23
# File 'lib/deepl/exceptions/document_translation_error.rb', line 15

def initialize(message, handle, error = nil)
  super(message)
  @handle = handle
  @document_handle = handle
  return unless error.is_a?(Error)

  @http_status_code = error.http_status_code
  @should_retry = error.should_retry?
end

Instance Attribute Details

#document_handle ⇒ DeepL::Resources::DocumentHandle? (readonly)

Returns Handle of the uploaded document, nil if the upload failed. Use it to query the status or download the document later.

Returns:

  • (DeepL::Resources::DocumentHandle, nil) —

    Handle of the uploaded document, nil if the upload failed. Use it to query the status or download the document later.



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

def document_handle
  @document_handle
end

Instance Method Details

#should_retry? ⇒ Boolean

Returns should_retry? of the wrapped DeepL error, false without one.

Returns:

  • (Boolean) —

    should_retry? of the wrapped DeepL error, false without one.



26
27
28
# File 'lib/deepl/exceptions/document_translation_error.rb', line 26

def should_retry?
  @should_retry || false
end