use of com.netflix.zuul.exception.ZuulException in project zuul by Netflix.
the class BaseZuulFilterRunner method recordFilterError.
protected void recordFilterError(final I inMesg, final ZuulFilter<I, O> filter, final Throwable t) {
// Add a log statement for this exception.
final String errorMsg = "Filter Exception: filter=" + filter.filterName() + ", request-info=" + inMesg.getInfoForLogging() + ", msg=" + String.valueOf(t.getMessage());
if (t instanceof ZuulException && !((ZuulException) t).shouldLogAsError()) {
logger.warn(errorMsg);
} else {
logger.error(errorMsg, t);
}
// Store this filter error for possible future use. But we still continue with next filter in the chain.
final SessionContext zuulCtx = inMesg.getContext();
zuulCtx.getFilterErrors().add(new FilterError(filter.filterName(), filter.filterType().toString(), t));
if (zuulCtx.debugRouting()) {
Debug.addRoutingDebug(zuulCtx, "Running Filter failed " + filter.filterName() + " type:" + filter.filterType() + " order:" + filter.filterOrder() + " " + t.getMessage());
}
}
use of com.netflix.zuul.exception.ZuulException in project zuul by Netflix.
the class ProxyEndpoint method verifyOrigin.
private void verifyOrigin(SessionContext context, HttpRequestMessage request, String restClientName, Origin primaryOrigin) {
if (primaryOrigin == null) {
// If no origin found then add specific error-cause metric tag, and throw an exception with 404 status.
context.put(CommonContextKeys.STATUS_CATGEORY, SUCCESS_LOCAL_NO_ROUTE);
String causeName = "RESTCLIENT_NOTFOUND";
originNotFound(context, causeName);
ZuulException ze = new ZuulException("No origin found for request. name=" + restClientName + ", uri=" + request.reconstructURI(), causeName);
ze.setStatusCode(404);
throw ze;
}
}
Aggregations