2013-03-20 21:48:22 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-23 21:32:42 +02:00
|
|
|
* Nextcloud - News
|
2014-04-19 18:16:55 +02:00
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later. See the COPYING file.
|
|
|
|
*
|
2018-03-27 15:35:06 +02:00
|
|
|
* @author Alessandro Cosentino <cosenal@gmail.com>
|
|
|
|
* @author Bernhard Posselt <dev@bernhard-posselt.com>
|
|
|
|
* @copyright 2012 Alessandro Cosentino
|
|
|
|
* @copyright 2012-2014 Bernhard Posselt
|
2014-04-19 18:16:55 +02:00
|
|
|
*/
|
2013-03-20 21:48:22 +01:00
|
|
|
|
2020-08-29 23:39:35 +02:00
|
|
|
namespace OCA\News\Service\Exceptions;
|
2013-03-20 21:48:22 +01:00
|
|
|
|
2021-01-02 17:57:17 +01:00
|
|
|
use Exception;
|
|
|
|
use OCP\AppFramework\Db\IMapperException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class ServiceException
|
|
|
|
*
|
|
|
|
* @package OCA\News\Service\Exceptions
|
|
|
|
*/
|
|
|
|
abstract class ServiceException extends Exception
|
2018-03-27 15:35:06 +02:00
|
|
|
{
|
2013-03-20 21:48:22 +01:00
|
|
|
|
2014-10-21 16:45:36 +02:00
|
|
|
/**
|
|
|
|
* Constructor
|
2018-03-27 15:35:06 +02:00
|
|
|
*
|
2020-11-20 20:52:54 +01:00
|
|
|
* @param string $msg the error message
|
|
|
|
* @param int $code
|
|
|
|
* @param Exception|null $previous
|
2014-10-21 16:45:36 +02:00
|
|
|
*/
|
2021-01-02 17:57:17 +01:00
|
|
|
final public function __construct(string $msg, int $code = 0, ?Exception $previous = null)
|
2018-03-27 15:35:06 +02:00
|
|
|
{
|
2021-01-02 17:57:17 +01:00
|
|
|
parent::__construct($msg, $code, $previous);
|
2014-10-21 16:45:36 +02:00
|
|
|
}
|
2021-01-02 17:57:17 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create exception from Mapper exception.
|
|
|
|
*
|
2020-11-20 20:52:54 +01:00
|
|
|
* @param IMapperException $exception Existing exception
|
2021-01-02 17:57:17 +01:00
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
abstract public static function from(IMapperException $exception): ServiceException;
|
2018-11-29 20:59:46 +01:00
|
|
|
}
|