Toshi
Toshi

Reputation: 6342

Laravel 5 Customexception

I'm playing around with Laravel5 to test out custom exception. But It returns the error

Call to a member function send() on string

and I can't really figure out why.

1.routes.php

routes.php

2.App/Exceptions/toshikiER.php

App\Exceptions\toshikiER.php

3.composer.php

composer.json

4.App/Exceptions/Hanlder.php

App\Exceptions\Handler.php

Upvotes: 1

Views: 92

Answers (1)

ChainList
ChainList

Reputation: 1208

If you take a look at the render method annotations.

/**
 * Render an exception into a response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $e
 * @return \Illuminate\Http\Response
 */

You'll see that you have to return a \Illuminate\Htttp\Response.

I made my own exception too, I handle my new exception like this

return response()->view("your.view", [], 403);

Upvotes: 3

Related Questions