diff --git a/src/Core/GSFile.php b/src/Core/GSFile.php index a5367026b9..ad08a8cbfa 100644 --- a/src/Core/GSFile.php +++ b/src/Core/GSFile.php @@ -27,6 +27,7 @@ use App\Entity\Attachment; use App\Util\Common; use App\Util\Exception\DuplicateFoundException; use App\Util\Exception\NoSuchFileException; +use App\Util\Exception\NotStoredLocallyException; use App\Util\Exception\NotFoundException; use App\Util\Exception\ServerException; use SplFileInfo; @@ -133,7 +134,9 @@ class GSFile } return $response; } else { - throw new ServerException(_m('This attachment is not stored locally.')); + // @codeCoverageIgnoreStart + throw new NotStoredLocallyException; + // @codeCoverageIgnoreEnd } } diff --git a/src/Util/Exception/NotStoredLocallyException.php b/src/Util/Exception/NotStoredLocallyException.php new file mode 100644 index 0000000000..a39ff767d3 --- /dev/null +++ b/src/Util/Exception/NotStoredLocallyException.php @@ -0,0 +1,30 @@ +. +// }}} + +namespace App\Util\Exception; + +use function App\Core\I18n\_m; + +class NotStoredLocallyException extends NoSuchFileException +{ + public function __construct() + { + parent::__construct(_m('This attachment is not stored locally')); + } +}