diff options
Diffstat (limited to 'lib/Service/Exceptions/ServiceNotFoundException.php')
-rw-r--r-- | lib/Service/Exceptions/ServiceNotFoundException.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Service/Exceptions/ServiceNotFoundException.php b/lib/Service/Exceptions/ServiceNotFoundException.php index 6c68ea6b2..f70706506 100644 --- a/lib/Service/Exceptions/ServiceNotFoundException.php +++ b/lib/Service/Exceptions/ServiceNotFoundException.php @@ -13,16 +13,21 @@ namespace OCA\News\Service\Exceptions; +use Exception; +use OCP\AppFramework\Db\IMapperException; + +/** + * Class ServiceNotFoundException + * + * @package OCA\News\Service\Exceptions + */ class ServiceNotFoundException extends ServiceException { - /** - * Constructor - * - * @param string $msg the error message + * @inheritDoc */ - public function __construct(string $msg) + public static function from(IMapperException $exception): ServiceException { - parent::__construct($msg); + return new self($exception->getMessage(), $exception->getCode(), $exception); } } |