custom exception in lumen

Posted 6 months ago by salvador98

hi . how i can make custom exception ? i use this but not work

<?php

namespace App\Exceptions;


use Exception;

class RobotException extends Exception
{


    public function render()
    {
        return response(['error' => 'my error msg'], 422);
    }
}

$router->get('/', function () use ($router) {
    throw new \App\Exceptions\RobotException();
});

Please sign in or create an account to participate in this conversation.