aboutsummaryrefslogtreecommitdiff
path: root/src/CamilStaps/BotleaguesApi/Exception/ValidationException.php
blob: c59ae6f8adc8b427aaec3f42740daae632f7599c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
    }

}