Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: catch des "RejectedItemException" #14

Open
clemzarch opened this issue Jun 22, 2023 · 0 comments
Open

TODO: catch des "RejectedItemException" #14

clemzarch opened this issue Jun 22, 2023 · 0 comments

Comments

@clemzarch
Copy link
Contributor

il faudrait catch les RejectedItemException, ajouter un log, et laisser passer la pipeline.
j'ai essayé:

# src/PipelineRunner.php

    public function run(
        \Iterator $source,
        \Generator $coroutine,
        RejectionInterface $rejection,
        StateInterface $state,
    ): \Iterator {
        $state->initialize();
        $rejection->initialize();

        $wrapper = new GeneratorWrapper();
        $wrapper->rewind($source, $coroutine);

        while ($wrapper->valid($source)) {
            try {
                $bucket = $coroutine->send($source->current());
            } catch (RejectedItemException $exception) {
                $rejection->reject($source->current());
                $state->reject();

                $this->logger->log(
                    $this->rejectionLevel,
                    'Some data was rejected from the pipeline',
                    [
                        'line' => $source->current(),
                        'exception' => $exception,
                    ]
                );
            }

            if (null === $bucket) {
                break;
            }

mais ca ne marche pas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant