Risk assessment error handling

The Spotlight integration includes a framework that handles error conditions between PolicyCenter and Spotlight. The SpotlightErrorCollector.gs class collects errors encountered while getting risk assessment details for a PolicyLocation from Spotlight. This class passes the error collector to the RiskAssessmentErrorHandler which has a method to handle the errors in the collector.

The error collector passes the errors to one of two error handler implementations: SpotlightInteractiveErrorHandler and SpotlightNonInteractiveErrorHandler, for handling errors in interactive and non-interactive modes, respectively. Each error is associated by a type specified in the type list RiskAssessmentError.tti.

Request and location level errors

All errors are specified in the RiskAssessmentError typelist and have an associated category from the RiskAssessmentErrorType typelist. The error types are Request and Location. Request level errors are errors associated with the entire request, and not the locations. These are errors such as the connection was refused, insufficient permission, or something that causes the entire request to fail. Location level errors are errors associated with a specific location. An example of a location level error is an invalid address.

Request level errors are stored in InboundPeriodRiskAssessmentErrorTempStore temporary objects. Location level errors are stored in InboundLocationRiskAssessmentErrorTempStore temporary objects. These errors are linked to their corresponding OutboundPeriodRiskAssessmentTempStore and OutboundLocationRiskAssessmentTempStore objects so that these errors can be handled by the RiskAssessmentErrorHandler.

In interactive and non-interactive modes, some errors are written to the log file.

In interactive mode, the errors are stored in their respective temporary objects and appear when the locations are revisited in the user interface.

In non-interactive mode, an activity is created for each job and error type. The activity is assigned it to the underwriter and the producer user roles on the current job. You can configure the roles that the activities are assigned to in SpotlightNotificationActivityCreator.gs.