@Gewora it works fine even if the exception is coming from another class.
class TestException extends \Exception{}
class AnotherClass
{
public function test()
{
throw new TestException();
}
}
$router->get('test', function(){
(new AnotherClass())->test();
return redirect()->route('index')->withErrors(['something else']);
});
/**
* Render an exception into a response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
if($e instanceof \TestException)
{
return redirect()->route('model.create')->withErrors(['test']);
}
return parent::render($request, $e);
}
There is no bug.
You have a bit aggressive attitude although I take the time to test it on my machine.