forked from GNUsocial/gnu-social
[UTIL][EXCEPTIONS] Introduce NotStoredLocallyException
This commit is contained in:
parent
33bf99cfda
commit
fb861ed41f
@ -27,6 +27,7 @@ use App\Entity\Attachment;
|
|||||||
use App\Util\Common;
|
use App\Util\Common;
|
||||||
use App\Util\Exception\DuplicateFoundException;
|
use App\Util\Exception\DuplicateFoundException;
|
||||||
use App\Util\Exception\NoSuchFileException;
|
use App\Util\Exception\NoSuchFileException;
|
||||||
|
use App\Util\Exception\NotStoredLocallyException;
|
||||||
use App\Util\Exception\NotFoundException;
|
use App\Util\Exception\NotFoundException;
|
||||||
use App\Util\Exception\ServerException;
|
use App\Util\Exception\ServerException;
|
||||||
use SplFileInfo;
|
use SplFileInfo;
|
||||||
@ -133,7 +134,9 @@ class GSFile
|
|||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
} else {
|
} else {
|
||||||
throw new ServerException(_m('This attachment is not stored locally.'));
|
// @codeCoverageIgnoreStart
|
||||||
|
throw new NotStoredLocallyException;
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
src/Util/Exception/NotStoredLocallyException.php
Normal file
30
src/Util/Exception/NotStoredLocallyException.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// {{{ License
|
||||||
|
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||||
|
//
|
||||||
|
// GNU social is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// GNU social is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
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'));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user