dingo / dingo/api

I am using try catch in my controller if i am getting form validation error means then it will throw custom exception

Open
#1,376 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
9.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I am using try catch in my controller but i am create custom exception,If i am getting form validation error means then it will throw custom exception but i do not need like that if form validation error then it will come back with form validation error based on last form submit..

This is my exception controller but i am put do not report validationexception.. i do not know why i am getting anybody face this issue give solutions as soon as possible..

getMessage();

return \Response::view('custom_exp');
}
elseif($exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException) {
return \Response::view('custom_exp');
}
elseif($this->isHttpException($exception)){
switch ($exception->getStatusCode()) {
case '404':
\Log::error($exception);
return \Response::view('custom_exp');
break;

case '500':
\Log::error($exception);
return \Response::view('custom_exp');
break;

case '405':
\Log::error($exception);
return \Response::view('custom_exp');
break;

default:
return $this->renderHttpException($exception);
break;
}
}
else
{
return parent::render($request, $exception);
}
//return parent::render($request, $exception);
}

/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.