laravel throw exception with status code

68

throwexception laravel -

throw new \ErrorException('Error found');

laravel throw exception with status code -

try {
    throw new Exception("Some error message", 30);
  //here 30 is the custom code
} catch(Exception $e) {
    echo "The exception code is: " . $e->getCode();
}

Comments

Submit
0 Comments