Skip to content

Throwing exception in a child results in empty ParralelError in catch() #254

@FluffyDiscord

Description

@FluffyDiscord

I am confused

$pool->add(function () use ($selectedCompressor, $sourcePath, $targetPath) {
                try {
                    return $selectedCompressor->compress($sourcePath, $targetPath);
                } catch (\Throwable $throwable) {
                    throw new CompressionFailedException($sourcePath, previous: $throwable);
                }
            })->then(function (?CompressionResult $compressionResult) use ($stats, $updateUi, $sourcePath, $targetPath, $fileEntry) {
                // not relevant
            })->catch(function (CompressionFailedException $exception) use ($stats) {
                // works
            })
            ->catch(function (\Throwable $exception) use ($stats) {
                //  also throws, but its empty Spatie\Async\Output\ParallelError - no message, no code, weird trace, what is going on
                \Symfony\Component\VarDumper\VarDumper::dump(['anything' => $exception]);
            });

// the compressor compress function

public function compress(string $source, string $target): CompressionResult
{
        throw new CompressionFailedException('test.zip');
}

Either the exception type filtering doesn't work properly, or I am missing something.

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