public static function toStackTrace($ex)
    {
        $list = [];
        for ($stack = Throwable::getThrowableStack($ex); $stack !== null; $stack = $stack['prev'])
        {
            $list = array_merge($stack['trace'], $list);
        }

        return $list;
    }