Also RainLoop exceptions to RuntimeException

This commit is contained in:
the-djmaze 2022-10-24 10:55:29 +02:00
parent c94e38b297
commit 7f231ef24f
5 changed files with 6 additions and 11 deletions

View file

@ -6,7 +6,7 @@ namespace RainLoop\Exceptions;
* @category RainLoop
* @package Exceptions
*/
class ClientException extends Exception
class ClientException extends \RuntimeException
{
/**
* @var string

View file

@ -1,5 +0,0 @@
<?php
namespace RainLoop\Exceptions;
class Exception extends \Exception {}

View file

@ -150,7 +150,7 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
.'/.files/'.\sha1($sKey);
if ($bMkDir && !\is_dir(\dirname($sFilePath)) && !\mkdir(\dirname($sFilePath), 0700, true)) {
throw new \RainLoop\Exceptions\Exception('Can\'t make storage directory "'.$sFilePath.'"');
throw new \RuntimeException('Can\'t make storage directory "'.$sFilePath.'"');
}
return $sFilePath;

View file

@ -147,7 +147,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
if ($bMkDir && !empty($sFilePath) && !\is_dir($sFilePath) && !\mkdir($sFilePath, 0700, true))
{
throw new \RainLoop\Exceptions\Exception('Can\'t make storage directory "'.$sFilePath.'"');
throw new \RuntimeException('Can\'t make storage directory "'.$sFilePath.'"');
}
return $sFilePath;

View file

@ -255,17 +255,17 @@ class Utils
{
$dir = \dirname($filename);
if (!\is_dir($dir) && !\mkdir($dir, 0700, true)) {
throw new Exceptions\Exception('Failed to create directory "'.$dir.'"');
throw new \RuntimeException('Failed to create directory "'.$dir.'"');
}
if (false === \file_put_contents($filename, $data)) {
throw new Exceptions\Exception('Failed to save file "'.$filename.'"');
throw new \RuntimeException('Failed to save file "'.$filename.'"');
}
\clearstatcache();
\chmod($filename, 0600);
/*
try {
} catch (\Throwable $oException) {
throw new Exceptions\Exception($oException->getMessage() . ': ' . \error_get_last()['message']);
throw new \RuntimeException($oException->getMessage() . ': ' . \error_get_last()['message']);
}
*/
}