# Global Event: OnExceptionThrown

Called when an application exception is thrown in the user interface. Generally used to pass additional or different information to the Exago logfile.

Signature

For custom code the args array is structured as follows:

args[] is contains three objects, the System.Exception, the WebReports.Api.Common.Logger, which provides write access to the Exago logfile, and a string of JSON data with the AJAX arguments which can provide more information in the log regarding the users requests which resulted in the exception being thrown.

For .Net Assemblies the method signature is as follows:

bool EventHandlerName(SessionInfo sessionInfo, Exception exception, Logger logger, string jsonArgs)

Expected Return

The event expects a boolean return value, which if true, will not continue logging the error.

Example

    var exception = args[0] as System.Exception;
    var logger = args[1] as WebReports.Api.Common.Logger;
    logger.ErrorFormat("User Id: {0}, Exception: {1}", sessionInfo.SetupData.Parameters.UserId, exception);
    return true;  // means not to continue logging (since we already did)