<commit_before><?php
namespace CDavison\Queue;

class WorkerBusyException extends \Exception {}<commit_msg>WorkerBusyException now constructs itself based on the busy worker. The worker may be retrieved when this exception is caught.<commit_after><?php
namespace CDavison\Queue;

use CDavison\Queue\WorkerInterface;

class WorkerBusyException extends \Exception
{
    /**
     * The busy worker.
     *
     * @var WorkerInterface
     */
    protected $worker;

    /**
     * Create a busy worker exception.
     *
     * @param WorkerInterface The busy worker.
     * @param string|null $message
     * @param integer $code
     * @param \Exception|null $previous
     */
    public function __construct(
        $worker,
        $message = null,
        $code = 0,
        \Exception $previous = null
    ) {
        parent::__construct($message, $code, $previous);
        $this->setWorker($worker);
    }

    /**
     * Attach a worker to this exception.
     *
     * @param WorkerInterface $worker
     */
    protected function setWorker(WorkerInterface $worker)
    {
        $this->worker = $worker;
    }

    /**
     * Retrieve the worker that generated this error.
     * 
     * @return WorkerInterface
     */
    public function getWorker()
    {
        return $this->worker;
    }
}
{'fraction_non_alphanumeric': 0.10130468150422103, 'fraction_numerical': 0.0007674597083653108, 'mean_word_length': 2.3608247422680413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1333027', 'n_tokens_mistral': 366, 'n_tokens_neox': 360, 'n_words': 104}