Skip to content

Commit 00caadf

Browse files
authored
feat(core): improve exceptions related to internal storage (#1434)
1 parent d0d3c42 commit 00caadf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/core/src/FrameworkKernel.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,15 @@ public function registerInternalStorage(): self
168168
$path = $this->root . '/.tempest';
169169

170170
if (! is_dir($path)) {
171-
mkdir($path, recursive: true);
171+
if (file_exists($path)) {
172+
throw new \RuntimeException('Unable to create internal storage directory, as a file with the same name (.tempest) already exists.');
173+
}
174+
175+
if (! mkdir($path, recursive: true)) {
176+
throw new \RuntimeException('Unable to create internal storage directory because of insufficient user permission on the root directory.');
177+
}
178+
} elseif (! is_writable($path)) {
179+
throw new \RuntimeException('Insufficient user permission to write to internal storage directory.');
172180
}
173181

174182
$this->internalStorage = realpath($path);

0 commit comments

Comments
 (0)