mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-30 20:18:00 +00:00
Do not swallow previous exception (#1778)
The previous exception will be included when loading the content as DOM Document fails. This makes debugging the reason behind the failure much easier.
This commit is contained in:
@@ -650,7 +650,7 @@ class Html extends BaseReader
|
||||
$loaded = false;
|
||||
}
|
||||
if ($loaded === false) {
|
||||
throw new Exception('Failed to load ' . $pFilename . ' as a DOM Document');
|
||||
throw new Exception('Failed to load ' . $pFilename . ' as a DOM Document', 0, $e ?? null);
|
||||
}
|
||||
|
||||
return $this->loadDocument($dom, $spreadsheet);
|
||||
@@ -672,7 +672,7 @@ class Html extends BaseReader
|
||||
$loaded = false;
|
||||
}
|
||||
if ($loaded === false) {
|
||||
throw new Exception('Failed to load content as a DOM Document');
|
||||
throw new Exception('Failed to load content as a DOM Document', 0, $e ?? null);
|
||||
}
|
||||
|
||||
return $this->loadDocument($dom, $spreadsheet ?? new Spreadsheet());
|
||||
|
||||
Reference in New Issue
Block a user