Skip to content

Commit

Permalink
Improve exception message
Browse files Browse the repository at this point in the history
This exception is commonly thrown in Laravel applications when using Docker.
But it is not clear why the system could not open a file that has read permission
for all users. So, when I came to the code of Monolog I saw that you try to open it
in append mode, so I think that just adding this information could help a lot other
users.
  • Loading branch information
axellbrendow authored and Seldaek committed Jul 23, 2020
1 parent c3a05db commit bcca19c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Monolog/Handler/StreamHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ protected function write(array $record)
restore_error_handler();
if (!is_resource($this->stream)) {
$this->stream = null;
throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url));

throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $this->url));
}
}

Expand Down

0 comments on commit bcca19c

Please sign in to comment.