Page MenuHomePhabricator

D17777.diff
No OneTemporary

D17777.diff

diff --git a/src/filesystem/PhutilDeferredLog.php b/src/filesystem/PhutilDeferredLog.php
--- a/src/filesystem/PhutilDeferredLog.php
+++ b/src/filesystem/PhutilDeferredLog.php
@@ -177,25 +177,31 @@
// and invoke possible __toString() calls.
$line = $this->format();
- if ($this->file !== null) {
- $dir = dirname($this->file);
- if (!Filesystem::pathExists($dir)) {
- Filesystem::createDirectory($dir, 0755, true);
- }
+ try {
+ if ($this->file !== null) {
+ $dir = dirname($this->file);
+ if (!Filesystem::pathExists($dir)) {
+ Filesystem::createDirectory($dir, 0755, true);
+ }
- $ok = @file_put_contents(
- $this->file,
- $line,
- FILE_APPEND | LOCK_EX);
+ $ok = @file_put_contents(
+ $this->file,
+ $line,
+ FILE_APPEND | LOCK_EX);
- if ($ok === false) {
- $message = pht("Unable to write to logfile '%s'!", $this->file);
- if ($this->failQuietly) {
- phlog($message);
- } else {
- throw new Exception($message);
+ if ($ok === false) {
+ throw new Exception(
+ pht(
+ 'Unable to write to logfile "%s"!',
+ $this->file));
}
}
+ } catch (Exception $ex) {
+ if ($this->failQuietly) {
+ phlog($ex);
+ } else {
+ throw $ex;
+ }
}
$this->didWrite = true;

File Metadata

Mime Type
text/plain
Expires
May 12 2024, 7:35 AM (5 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6290908
Default Alt Text
D17777.diff (1 KB)

Event Timeline