src/Message.php
static function importException(array $export, ?array $args = null) {
        if(!empty($export['phoebeExceptionHandler'])) {
            return \CharlotteDunois\Phoebe\ExceptionHandler::getInstance()->importException($export);
        }
        
        if($args === null) {
            $args = array($export['message'], $export['code']);
        }
        
        $args[] = (!empty($export['previous']) ? static::importException($export['previous']) : null);
        
        $class = new \ReflectionClass($export['class']);
        $err = $class->newInstanceArgs($args);
        
        $prop = $class->getProperty('file');
        $prop->setAccessible(true);
        $prop->setValue($err, $export['file']);
        
        $prop = $class->getProperty('line');
        $prop->setAccessible(true);
        $prop->setValue($err, $export['line']);
        
        if($class->hasProperty('trace')) {
            $prop = $class->getProperty('trace');
            
            $prop->setAccessible(true);
            $prop->setValue($err, $export['trace']);
        } else {
            $parent = $class;
            
            while($parent = $parent->getParentClass()) {
                if($parent->hasProperty('trace')) {
                    $prop = $parent->getProperty('trace');
                    
                    $prop->setAccessible(true);
                    $prop->setValue($err, $export['trace']);
                    break;
                }
            }
        }
        
        return $err;
    }
static function importException(array $export, ?array $args = null) {
        if(!empty($export['phoebeExceptionHandler'])) {
            return \CharlotteDunois\Phoebe\ExceptionHandler::getInstance()->importException($export);
        }
        
        if($args === null) {
            $args = array($export['message'], $export['code']);
        }
        
        $args[] = (!empty($export['previous']) ? static::importException($export['previous']) : null);
        
        $class = new \ReflectionClass($export['class']);
        $err = $class->newInstanceArgs($args);
        
        $prop = $class->getProperty('file');
        $prop->setAccessible(true);
        $prop->setValue($err, $export['file']);
        
        $prop = $class->getProperty('line');
        $prop->setAccessible(true);
        $prop->setValue($err, $export['line']);
        
        if($class->hasProperty('trace')) {
            $prop = $class->getProperty('trace');
            
            $prop->setAccessible(true);
            $prop->setValue($err, $export['trace']);
        } else {
            $parent = $class;
            
            while($parent = $parent->getParentClass()) {
                if($parent->hasProperty('trace')) {
                    $prop = $parent->getProperty('trace');
                    
                    $prop->setAccessible(true);
                    $prop->setValue($err, $export['trace']);
                    break;
                }
            }
        }
        
        return $err;
    }
Converts an exported exception back into a Throwable.
@param array       $export
@param array|null  $args    Passed to the constructor if not using the Exception Handler.
@return \Throwable