title: How to register custom exception handler in laravel 8
body: <p>In Laravel 7 this code works fine. Using <code>renderable</code> method also works in laravel 8. But I'm not sure how to register it in laravel 8 after creating a <code>CustomException</code> class.</p>
  <pre><code>    public function render($request, Exception $exception)
      {
          if ($exception instanceof ValidationException) {
              if ($request-&gt;expectsJson()) {
                  return response('Sorry, validation failed.', 422);
              }
          }
  
          return parent::render($request, $exception);
      }
  </code></pre>