Exception: DeepL::Exceptions::TranslationMemoryJobError

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

Overview

Any failure of DeepL::Client#import_translation_memory_from_filepath or #export_translation_memory_to_filepath except a missing input file. The failure being wrapped is the cause.

Instance Attribute Summary collapse

Attributes inherited from Error

#http_status_code

Instance Method Summary collapse

Methods inherited from Error

#should_retry?

Constructor Details

#initialize(message, job_id, job, error = nil) ⇒ TranslationMemoryJobError

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



23
24
25
26
27
28
29
# File 'lib/deepl/exceptions/translation_memory_job_error.rb', line 23

def initialize(message, job_id, job, error = nil)
  deepl_error = error.is_a?(Error) ? error : nil
  super(message, http_status_code: deepl_error&.http_status_code,
                 should_retry: deepl_error&.should_retry? || false)
  @job_id = job_id
  @job = job
end

Instance Attribute Details

#job ⇒ DeepL::Resources::TranslationMemoryJob? (readonly)

Returns The last job status the helper fetched, nil before the first status check.

Returns:



19
20
21
# File 'lib/deepl/exceptions/translation_memory_job_error.rb', line 19

def job
  @job
end

#job_id ⇒ String? (readonly)

Returns ID of the import or export job, set as soon as the job was created, nil if the failure happened before. Use it to query or resume the job.

Returns:

  • (String, nil) —

    ID of the import or export job, set as soon as the job was created, nil if the failure happened before. Use it to query or resume the job.



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

def job_id
  @job_id
end