summaryrefslogtreecommitdiffstats
path: root/lib/Service/Exceptions/ServiceValidationException.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Service/Exceptions/ServiceValidationException.php')
-rw-r--r--lib/Service/Exceptions/ServiceValidationException.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Service/Exceptions/ServiceValidationException.php b/lib/Service/Exceptions/ServiceValidationException.php
index 8e9dc9fee..c41ce4aac 100644
--- a/lib/Service/Exceptions/ServiceValidationException.php
+++ b/lib/Service/Exceptions/ServiceValidationException.php
@@ -13,16 +13,22 @@
namespace OCA\News\Service\Exceptions;
+use Exception;
+use OCP\AppFramework\Db\IMapperException;
+
+/**
+ * Class ServiceValidationException
+ *
+ * @package OCA\News\Service\Exceptions
+ */
class ServiceValidationException 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);
}
}