public LinkedInException(Error error, Response response) { super(error.getMessage(), response); this.error = error; this.response = response; }
/** * Create an instance of {@link Error } * */ public Error createError() { return new Error(); }
@Override protected Object doInvokeMethod(Map<String, Object> args) { try { return super.doInvokeMethod(args); } catch (RuntimeCamelException e) { if (e.getCause() instanceof WebApplicationException) { WebApplicationException cause = (WebApplicationException) e.getCause(); final Response response = cause.getResponse(); if (response.hasEntity()) { // try and convert it to LinkedInException final org.apache.camel.component.linkedin.api.model.Error error = response.readEntity(Error.class); throw new RuntimeCamelException( String.format("Error invoking %s: %s", method.getName(), error.getMessage()), new LinkedInException(error, response)); } } throw e; } } }
@Override protected Object doInvokeMethod(ApiMethod method, Map<String, Object> properties) throws RuntimeCamelException { try { return super.doInvokeMethod(method, properties); } catch (RuntimeCamelException e) { if (e.getCause() instanceof WebApplicationException) { final WebApplicationException cause = (WebApplicationException) e.getCause(); final Response response = cause.getResponse(); if (response.hasEntity()) { // try and convert it to LinkedInException final org.apache.camel.component.linkedin.api.model.Error error = response.readEntity(Error.class); throw new RuntimeCamelException( String.format("Error invoking %s: %s", method.getName(), error.getMessage()), new LinkedInException(error, response)); } } throw e; } } }
@Override protected Object doInvokeMethod(Map<String, Object> args) { try { return super.doInvokeMethod(args); } catch (RuntimeCamelException e) { if (e.getCause() instanceof WebApplicationException) { WebApplicationException cause = (WebApplicationException) e.getCause(); final Response response = cause.getResponse(); if (response.hasEntity()) { // try and convert it to LinkedInException final org.apache.camel.component.linkedin.api.model.Error error = response.readEntity(Error.class); throw new RuntimeCamelException( String.format("Error invoking %s: %s", method.getName(), error.getMessage()), new LinkedInException(error, response)); } } throw e; } } }
@Override protected Object doInvokeMethod(ApiMethod method, Map<String, Object> properties) throws RuntimeCamelException { try { return super.doInvokeMethod(method, properties); } catch (RuntimeCamelException e) { if (e.getCause() instanceof WebApplicationException) { final WebApplicationException cause = (WebApplicationException) e.getCause(); final Response response = cause.getResponse(); if (response.hasEntity()) { // try and convert it to LinkedInException final org.apache.camel.component.linkedin.api.model.Error error = response.readEntity(Error.class); throw new RuntimeCamelException( String.format("Error invoking %s: %s", method.getName(), error.getMessage()), new LinkedInException(error, response)); } } throw e; } } }