}
protected Response handleException(OAuthServiceException ex, String error) {
OAuthError customError = ex.getError();
if (writeCustomErrors && customError != null) {
return createErrorResponseFromBean(customError);
} else {
return createErrorResponseFromBean(new OAuthError(error));
}
}