module

JoobQ::ErrorHandler

Error classification and handling utilities

Constants

MAX_BACKTRACE_BYTES = 8192
MAX_MESSAGE_BYTES = 4096

The most of an error's message and backtrace kept on a stored job (bytes; the backtrace is also at most 20 lines). A job with its error is written to the retry and dead letter sets and read back by every console.

Class methods

handle_job_error(job : Job, queue : BaseQueue, exception : Exception, worker_id : String, retry_count : Int32 = 0, additional_context : Hash(String, String) = {} of String => String, schedule : Bool = true) : ErrorContext
Source
log_error(error_context : ErrorContext) : Nil
Source
schedule_retry(job : Job, queue : BaseQueue, error_context : ErrorContext) : Nil
Source
send_to_dead_letter(job : Job, queue : BaseQueue, error_context : ErrorContext) : Job
Source
truncated(text : String, max_bytes : Int32) : String

text cut to at most max_bytes bytes, on a character boundary, ending with "..." when cut

Source
update_job_with_error(job : Job, error_context : ErrorContext) : Job

Records the error on the job and returns the job. A struct job is copied when it is passed in, so callers use the job returned: job = ErrorHandler.update_job_with_error(job, context).

Source