Skip to content

Commit

Permalink
fix: better and more verbose error message on failed write
Browse files Browse the repository at this point in the history
  • Loading branch information
odinuv committed May 12, 2018
1 parent 2489d9e commit 3263de8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/CsvFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ public function writeRow(array $row)
as an error. Therefore both conditions are necessary. */
if (($ret === false) || (($ret === 0) && (strlen($str) > 0))) {
throw new Exception(
"Cannot write to file {$this->getPathname()}",
"Cannot write to CSV file " . $this->getPathname() .
' Error: ' . error_get_last()['message'] . ' Return: ' . json_encode($ret) .
' To write: ' . strlen($str) . ' Written: ' . $ret,
Exception::WRITE_ERROR,
null,
Exception::WRITE_ERROR_STR
Expand Down

0 comments on commit 3263de8

Please sign in to comment.