mirror of
https://github.com/danog/file.git
synced 2024-11-30 04:19:39 +01:00
Change invalid mode to Error; throw instead of returning Failure
This commit is contained in:
parent
64249c2c62
commit
a05915f953
@ -54,11 +54,7 @@ class EioDriver implements Driver {
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function open(string $path, string $mode): Promise {
|
public function open(string $path, string $mode): Promise {
|
||||||
try {
|
$flags = $this->parseMode($mode);
|
||||||
$flags = $this->parseMode($mode);
|
|
||||||
} catch (\Throwable $exception) {
|
|
||||||
return new Failure($exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
$chmod = ($flags & \EIO_O_CREAT) ? 0644 : 0;
|
$chmod = ($flags & \EIO_O_CREAT) ? 0644 : 0;
|
||||||
($this->incrementor)(1);
|
($this->incrementor)(1);
|
||||||
@ -85,7 +81,7 @@ class EioDriver implements Driver {
|
|||||||
case 'c+': return \EIO_O_RDWR | \EIO_O_CREAT;
|
case 'c+': return \EIO_O_RDWR | \EIO_O_CREAT;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new FilesystemException('Invalid file mode');
|
throw new \Error('Invalid file mode');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user