Search in sources :

Example 1 with ErrorHandler

use of com.evolveum.midpoint.provisioning.consistency.api.ErrorHandler in project midpoint by Evolveum.

the class ShadowCache method handleError.

@SuppressWarnings("rawtypes")
protected PrismObject<ShadowType> handleError(ProvisioningContext ctx, Exception ex, PrismObject<ShadowType> shadow, FailedOperation op, Collection<? extends ItemDelta> modifications, boolean doDiscovery, boolean compensate, OperationResult parentResult) throws SchemaException, GenericFrameworkException, CommunicationException, ObjectNotFoundException, ObjectAlreadyExistsException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
    if (parentResult.isUnknown()) {
        parentResult.computeStatus();
    }
    // fetch result in this case needs to be set
    if (FailedOperation.GET != op) {
        shadow = extendShadow(shadow, parentResult, ctx.getResource(), modifications);
    } else {
        shadow.asObjectable().setResource(ctx.getResource());
    }
    ErrorHandler handler = errorHandlerFactory.createErrorHandler(ex);
    if (handler == null) {
        parentResult.recordFatalError("Error without a handler. Reason: " + ex.getMessage(), ex);
        throw new SystemException(ex.getMessage(), ex);
    }
    LOGGER.debug("Handling provisioning exception {}: {}", new Object[] { ex.getClass(), ex.getMessage() });
    LOGGER.trace("Handling provisioning exception {}: {}\ndoDiscovery={}, compensate={}", new Object[] { ex.getClass(), ex.getMessage(), doDiscovery, compensate, ex });
    return handler.handleError(shadow.asObjectable(), op, ex, doDiscovery, compensate, ctx.getTask(), parentResult).asPrismObject();
}
Also used : ErrorHandler(com.evolveum.midpoint.provisioning.consistency.api.ErrorHandler)

Aggregations

ErrorHandler (com.evolveum.midpoint.provisioning.consistency.api.ErrorHandler)1