PHP exception handling

Most applications raise some errors that aren't bugs in your code. They happen when the app encounters unexpected input, like a bot filling in a form.

To stop these errors from showing up as problems in AppSignal, you can handle them in code or let AppSignal ignore certain errors entirely.

Ignore errors

AppSignal configuration lets you ignore errors. Provide a list of error names in a denylist, and AppSignal will not track them when they are raised.

Appsignal::setError

To record a handled exception use the Appsignal::setError() helper method. This is useful when catching and handling an error gracefully but still wanting to track it in AppSignal. For example, to monitor how often a fallback path is triggered.

PHP
try { SomeClass::riskyOperation(); } catch (Throwable $e) { Appsignal::setError($e); throw $e; }

The errors passed as an argument to Appsignal::setError() must implement the base Throwable interface.