protected function populateErrorData(\Throwable $e, array $data): \Throwable
    {
        static $cache = [];
        static $props = [
            'code',
            'message',
            'file',
            'line'
        ];
        
        $type = ($e instanceof \Error) ? \Error::class : \Exception::class;
        
        if (!isset($cache[$type])) {
            $cache[$type] = [];
            
            foreach ($props as $k) {
                $ref = new \ReflectionProperty($type, $k);
                $ref->setAccessible(true);
                
                $cache[$type][$k] = $ref;
            }
        }
        
        foreach ($props as $k) {
            if (isset($data[$k])) {
                $cache[$type][$k]->setValue($e, $data[$k]);
            }
        }
        
        return $e;
    }