Reputation: 2965
I am getting an exception of payload is invalid when editing the encrypted ID as manually.
I need to make as a json response for this exception like
['status=>400,'message'=>'The Payload is invalid']
When working with API's I am using the encrypted form of ID and I getting the HTML type exception for Payload is invalid. I wan to to change it to the json format for avoiding type issue in Mobile team.
Upvotes: 0
Views: 829
Reputation: 167
You can go to app/Exceptions/Handler.php. In render method.
public function render($request, Exception $exception)
{
if ($exception instanceof \Illuminate\Contracts\Encryption\DecryptException) {
return response()->json([
'message' => 'The Payload is invalid'
], 400);
}
return parent::render($request, $exception);
}
Upvotes: 2