Skip to content

Commit

Permalink
Do not swallow previous exception (#1778)
Browse files Browse the repository at this point in the history
The previous exception will be included when loading the content as DOM Document fails. This makes debugging the reason behind the failure much easier.
  • Loading branch information
JaZo committed Jan 29, 2021
1 parent 65837da commit 97aa78f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PhpSpreadsheet/Reader/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
$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);
Expand All @@ -672,7 +672,7 @@ public function loadFromString($content, ?Spreadsheet $spreadsheet = null): Spre
$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());
Expand Down

0 comments on commit 97aa78f

Please sign in to comment.