Skip to content

Commit

Permalink
fix: accessing thrown error inside realm.write results to "error prop…
Browse files Browse the repository at this point in the history
…erty does not exist" (#11)
  • Loading branch information
ian-wd authored Nov 7, 2022
1 parent b9e265c commit e31db2f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Models/Queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export class Queue {
} catch (error) {
// Handle job failure logic, including retries.
let jobData = JSON.parse(job.data);
const errorMessage = error?.message || '';

this.realm.write(() => {
// Increment failed attempts number
Expand All @@ -335,9 +336,9 @@ export class Queue {

// Log error
if (!jobData.errors) {
jobData.errors = [ error.message ];
jobData.errors = [ errorMessage ];
} else {
jobData.errors.push(error.message);
jobData.errors.push(errorMessage);
}

job.data = JSON.stringify(jobData);
Expand Down

0 comments on commit e31db2f

Please sign in to comment.