private function unpackThrowables($throwable)
    {
        if (!$throwable instanceof Throwable) {
            return [];
        }

        $throwables = [$throwable];
        while ($throwable = $throwable->getPrevious()) {
            $throwables[] = $throwable;
        }

        return $throwables;
    }