the browser-facing portion of osu!
at master 758 B view raw
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 ChangeUsernameException extends Exception 12{ 13 private $errors; 14 15 public function __construct($errors, Exception $previous = null) 16 { 17 if ($errors instanceof ValidationErrors) { 18 $message = $errors->toSentence(); 19 $this->errors = $errors; 20 } else { 21 $message = $errors; 22 } 23 24 parent::__construct($message, 0, $previous); 25 } 26 27 public function getErrors(): ValidationErrors 28 { 29 return $this->errors; 30 } 31}