1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace App\Exceptions;
7
8use App\Libraries\ValidationErrors;
9use Exception;
10
11class ValidationException extends Exception
12{
13 private $errors;
14
15 public function __construct(ValidationErrors $errors = null, Exception $previous = null)
16 {
17 $message = null;
18 if ($errors !== null) {
19 $message = $errors->toSentence();
20 }
21
22 parent::__construct($message, 0, $previous);
23 $this->errors = $errors;
24 }
25
26 public function getValidationErrors()
27 {
28 return $this->errors;
29 }
30}