Skip to content

Instantly share code, notes, and snippets.

@Mulkave
Created June 8, 2016 20:24
Show Gist options
  • Save Mulkave/6134d6053aba0611e197951e8195f61a to your computer and use it in GitHub Desktop.
Save Mulkave/6134d6053aba0611e197951e8195f61a to your computer and use it in GitHub Desktop.
<?php
namespace Directory\Foundation;
use Exception;
use Illuminate\Validation\Validator as IlluminateValidator;
class InvalidInputException extends Exception
{
public function __construct($message = “”, $code = 0, Exception $previous = null)
{
if ($message instanceof IlluminateValidator) {
$message = $message->messages()->all();
}
if (is_array($message)) {
$message = implode(“\n”, $message);
}
parent::__construct($message, $code, $previous);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment