An exception is always a 500 HTTP status code. An exception basically tells you that something broke in your application and you need to take action on it.
Luckily you can catch exceptions and perform some other action. In your case, you should catch the exception in your app/Exceptions/Handler.php and perform some action
// app/Exceptions/Handler.php
public function render($request, Throwable $exception)
{
if ($exception instanceof DontKnowException) {
abort(412, $exception->getMessage());
}
return parent::render($request, $exception);
}
Please be aware that the abort will call the whole main handler again, which in turn may log and notify about the same or another exception, including a possible duplicate.