// we want to only register one instance of the various error handler types and thus do some lookup
// if its a ErrorHandlerBuildRef. We need a bit of work to do that as there are potential indirection.
String ref = null;
if (builder instanceof ErrorHandlerBuilderRef) {
ErrorHandlerBuilderRef builderRef = (ErrorHandlerBuilderRef) builder;
// it has not then its an indirection and we should do some work to lookup the real builder
ref = builderRef.getRef();
builder = ErrorHandlerBuilderRef.lookupErrorHandlerBuilder(routeContext, builderRef.getRef());
// must do a 2nd lookup in case this is also a reference
// (this happens with spring DSL using errorHandlerRef on <route> as it gets a bit
// complex with indirections for error handler references
if (builder instanceof ErrorHandlerBuilderRef) {
builderRef = (ErrorHandlerBuilderRef) builder;
// does it refer to a non default error handler then do a 2nd lookup
if (!builderRef.getRef().equals(ErrorHandlerBuilderRef.DEFAULT_ERROR_HANDLER_BUILDER)) {
builder = ErrorHandlerBuilderRef.lookupErrorHandlerBuilder(routeContext, builderRef.getRef());
ref = builderRef.getRef();
}
}
}
if (ref != null) {