aboutsummaryrefslogtreecommitdiff
path: root/src/CamilStaps/BotleaguesApi/Exception/ValidationException.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/CamilStaps/BotleaguesApi/Exception/ValidationException.php')
-rw-r--r--src/CamilStaps/BotleaguesApi/Exception/ValidationException.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/CamilStaps/BotleaguesApi/Exception/ValidationException.php b/src/CamilStaps/BotleaguesApi/Exception/ValidationException.php
new file mode 100644
index 0000000..c59ae6f
--- /dev/null
+++ b/src/CamilStaps/BotleaguesApi/Exception/ValidationException.php
@@ -0,0 +1,18 @@
+<?php
+namespace CamilStaps\BotleaguesApi\Exception;
+
+use Symfony\Component\HttpKernel\Exception\HttpException;
+
+class ValidationException extends HttpException {
+
+ public function __construct($message = null, $errors = null, Exception $previous = null, $headers = [], $code = 0) {
+ if (is_null($errors)) {
+ $this->errors = new MessageBag;
+ } else {
+ $this->errors = is_array($errors) ? new MessageBag($errors) : $errors;
+ }
+
+ parent::__construct(422, $message, $previous, $headers, $code);
+ }
+
+} \ No newline at end of file