-
-
Notifications
You must be signed in to change notification settings - Fork 356
Exception Handling
Rock has a built in exception handling mechanism. Most exceptions should be caught and appropriately handled in the Blocks, however any unhandled exceptions will be logged by the core framework and an error page will be displayed. A few things worth noting:
- Exceptions are logged in the
ExceptionLog
table. - The
RockCleanup
job will clean this log/table while keeping N number of days' worth of exceptions. - There is an organization global attribute
Log404AsException
that will log any 404 File Not Found errors into the same log (no error will be displayed to the user). By default it is disabled since it adds overhead to the processing of the page. It's there for webmasters to occasionally enable in order to see and fix 404 errors.
In Rock each site can be configured to use a custom error page in the event of an exception. If no value is provided, error.aspx
will be shown which is skinned to match the Rock Theme. This standard error page will display the details of the exception if the logged in user is a part of the Rock Administrators security group.
New, custom error pages should be very simple – even static HTML. If one decides to make it more robust (i.e. by adding logic to display the error) it should be careful not to generate an exception itself because that would cause an infinite loop. A query parameter has been added to the error page to help catch these loops. If the parameter is not '1' then processing should not be done as it is causing an error.
There is a global attribute (EmailExceptionsList
) that controls who will receive exception notifications. Its value is a comma delimited list of email addresses.