diff options
Diffstat (limited to 'lib/Service/Exceptions/ServiceConflictException.php')
-rw-r--r-- | lib/Service/Exceptions/ServiceConflictException.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Service/Exceptions/ServiceConflictException.php b/lib/Service/Exceptions/ServiceConflictException.php index dd6ba03c9..ed3d3a54c 100644 --- a/lib/Service/Exceptions/ServiceConflictException.php +++ b/lib/Service/Exceptions/ServiceConflictException.php @@ -13,16 +13,22 @@ namespace OCA\News\Service\Exceptions; +use Exception; +use OCP\AppFramework\Db\IMapperException; + +/** + * Class ServiceConflictException + * + * @package OCA\News\Service\Exceptions + */ class ServiceConflictException 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); } } |