Skip to content

Error cause propagation

Latest

Choose a tag to compare

@RomainLanz RomainLanz released this 20 Jan 20:14
v0.3.3
04dbac8

New Feature

When rethrowing an error, the original error is now forwarded using the standard cause option.
This ensures the full error chain is preserved, making debugging and logging significantly easier.

export default class SendEmailJob extends Job<SendEmailPayload> {
  static options: JobOptions = {
    queue: 'email',
  }

  async execute(): Promise<void> {
    console.log(`Sending email to: ${this.payload.to}`)
  }
  
  failed(e) {
    console.log(e.cause)
  }
}