static function getChain(\Throwable $node): array
    {
        $chain = [];
        $hashMap = [];

        while ($node !== null && !isset($hashMap[$hash = spl_object_hash($node)])) {
            $chain[] = $node;
            $hashMap[$hash] = true;
            $node = $node->getPrevious();
        }

        return $chain;
    }