The default reporting behavior is defined in the report method of App\Exceptions\Handler class, however I'd like my custom exception class to use a different reporting behavior, defined its report method. However, it still propagates to the default reporting of the Handler class. I've tried returning true and false - no difference.
class MyException extends \Exception
{
public function report()
{
// custom reporting logic
return true; // return false;
}
}
@martinbean i don't want that particular exception be reported to Sentry, which is the default reporting behavior defined in exception handler. I want it to be reported to another place.
@dmag Reporting behaviour are not defined in the exception handler. Laravel uses log channels to specify where errors are recorded.
Why would you set up Sentry for error reporting, but then not want to send exceptions to Sentry? What’s special about this particular exception, and where do you want to report it?
@martinbean sorry, but your questions are irrelevant to my issue. If there's no way to stop propagation from inside the exception class, then okay. There's a way to stop propagation from inside the handler by appending stop(), but it's inside handler class, which is not what I want.
@dmag I’m just trying to understand your use case in order to suggest the most appropriate solution. They’re not “irrelevant” when I’m asking about questions specifically about your problem.
Usually when you find something difficult, it’s because you’re doing it wrong and fighting something rather than using the appropriate solution.
@martinbean thank you, but if there's no way to stop propagation fron inside exception class, then I will have to do it from inside the handler class, which would not be my choice otherwise.
@dmag Or you could just answer what’s special about the class, and why you want to log it somewhere other than Sentry, and then maybe someone can suggest the most appropriate solution for your problem?