php artisan make:exception TestException
新生成Exception是空的
但是因为继承Exception类,所以可以直接调用
throw new TestException('test');
且能正常输出
此时的错误code默认为0,
想要设定code和默认message,可以使用__construct
想要自定义设置错误,可以使用render()方法
php artisan make:exception TestException
新生成Exception是空的
但是因为继承Exception类,所以可以直接调用
throw new TestException('test');
且能正常输出
此时的错误code默认为0,
想要设定code和默认message,可以使用__construct
想要自定义设置错误,可以使用render()方法