Skip to content

TODO: catch des "RejectedItemException" #14

@clemzarch

Description

@clemzarch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions