Exception: DeepL::Exceptions::DocumentTranslationError
- Defined in:
- lib/deepl/exceptions/document_translation_error.rb
Instance Attribute Summary collapse
-
#document_handle ⇒ DeepL::Resources::DocumentHandle?
readonly
Handle of the uploaded document,
nilif the upload failed.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(message, handle, error = nil) ⇒ DocumentTranslationError
constructor
erroris the failure being wrapped; the HTTP status and retryability of a DeepL error are copied from it. -
#should_retry? ⇒ Boolean
should_retry?of the wrapped DeepL error,falsewithout one.
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(, handle, error = nil) super() @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.
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.
26 27 28 |
# File 'lib/deepl/exceptions/document_translation_error.rb', line 26 def should_retry? @should_retry || false end |