Refactor code to resolve jobs in WAIT_ASYNC into JQManagedJob. Add tests...

....
Sure - just add it to the exception as a property?

Sent from my iPhone

> On Oct 6, 2014, at 2:31 PM, Loren Norman <notifications@github.com> wrote:
> 
> In src/JQJobs/JQManagedJob.php:
> 
> > +     * @param string The jobId
> > +     * @param mixed The data/payload to report to the job's resolveWaitAsyncJob() method..
> > +     * @param boolean TRUE to convert exceptions thrown during resolveWaitAsyncJob() to FAILURE (mark job failed).
> > +     *                FALSE to re-throw exceptions. Useful for a webhook to re-try Exceptional failures. 
> > +     *                Default FALSE.
> > +     * @throws object JQStore_JobNotFoundException
> > +     * @throws object Exception Unhandled exceptions.
> > +     * @return void
> > +     */
> > +    public static function resolveWaitAsyncJob(JQStore $q, $jobId, $data, $convertExceptionToFailure = false)
> > +    {
> > +        // load job WITH MUTEX
> > +        $mJob = $q->getWithMutex($jobId);
> > +        if ($mJob->getStatus() !== JQManagedJob::STATUS_WAIT_ASYNC)
> > +        {
> > +            throw new JQManagedJob_InvalidStateException;
> Can we actually put the state into this exception so I can retrieve it when I catch? I only have the mJobId, not the mJob itself to ask, but this exception is totally in context I would think.
> 
> I need to be able to do different things based on which invalid state it was in.
> 
> I can make this trivial code change just wanted to run it by you first, designwise.
> 
> —
> Reply to this email directly or view it on GitHub.