title: How do I send a custom parameter to a custom exception in Laravel?
body: <p>I want to send my own parameters into custom exception using throw new CustomException.</p>
  
  <p>I've defined my own error codes into Config and these are necessary for me.</p>
  
  <pre><code>public function saveMenu($data){
      $validatedData = Validator::make($data, array(
          'id' =&gt; 'required',
          'menuID' =&gt; 'required',
  
  
      ));
      try {
          $validatedData-&gt;validate();
      } catch \Exception $e){
  
          $data= array(
              'status' =&gt; false,
              'code' =&gt; 599
              'message' =&gt; config('exception_codes.599').'&lt;br/&gt;'.$validatedData-&gt;errors(),
              'data' =&gt; []
          );
  
         throw new CustomException($data ['message'], $data['code'],$e);
          return $data;
      }
  </code></pre>
  
  <p>}</p>
  
  <p>class Handler extends ExceptionHandler
  {</p>
  
  <pre><code>protected $dontReport = [
      //
  ];
  
  protected $dontFlash = [
      'password',
      'password_confirmation',
  ];
  
  
  public function report( Exception $exception=NULL)
  {
  
  
      parent::report($exception);
  }
  
  public function render($request, Exception $exception)
  {
      return parent::render($request, $exception);
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>class CustomException extends Exception{
  
   public $code;
  public $message;
  public $trace;
  
  public function __construct( $message, $code, Exception $exception=NULL)
  
  {
      parent::__construct($message, $code, $exception);
      $this-&gt;code = $code;
      $this-&gt;message=$message;
      $this-&gt;trace= $exception-&gt;getTrace();
  }
  public function report($message, $code, Exception $exception=NULL)
  {
      $message = $exception-&gt;getMessage();
      $xx= new Menu();
      $xx-&gt;setFile($this-&gt;trace[1]['file']);
      $xx-&gt;setLine($this-&gt;trace[1]['line']);
      $xx-&gt;setFunction($this-&gt;trace[1]['function']);
      $xx-&gt;setClass($this-&gt;trace[1]['class']);
      $xx-&gt;setMessage($message);
      $xx-&gt;save();
      parent::report($exception);
  
  }
  
  public function render($request, Exception $exception)
  {
      return parent::render($request, $exception);
  }
  </code></pre>
  
  <p>I get this error;</p>
  
  <blockquote>
    <p>Too few arguments to function
    App\Exceptions\CustomException::report(), 0 passed in
    C:......\Handler.php on line 102 and at least 2 expected"</p>
  </blockquote>
  
  <p>Can you help me?</p>