kaliberjs / firebase-queue

A trimmed and more robust version of the original Firebase Queue
MIT License
20 stars 3 forks source link

Pass `reportError` to the `processTask` function #14

Open EECOLOR opened 5 years ago

EECOLOR commented 5 years ago

Please vote on this issue if you would like this feature to be added.


This feature request came from https://github.com/kaliberjs/firebase-queue/issues/11

Instead of this:

async function processTask(task) {
   try { ... }
   catch (e) { reportError(e); ... }
}

We want to do this:

async function processTask(task, { reportError }) {
   try { ... }
   catch (e) { reportError(e); ... }
}
geoervin commented 5 years ago

Does passing the function in this way change the default behavior outlined in https://github.com/kaliberjs/firebase-queue/issues/11#issuecomment-428839371 ?

EECOLOR commented 5 years ago

@geoervin Great question! No it does not, it is just a simplification.

Instead of passing the reportError to both the queue and processTask function, users of the library just pass it to the queue and have it available in the processTask function if needed.