static void ping(DeltaLink dLink) { Objects.requireNonNull(dLink); try { dLink.ping(); } catch (HttpException ex) { Throwable ex2 = ex; if ( ex.getCause() != null ) ex2 = ex.getCause(); throw new CmdException(ex2.getMessage()); } catch (JsonException ex) { throw new CmdException("Not an RDF Patch server"); } }
public QueryExceptionHTTP(int responseCode, String message, final HttpException ex) { this(responseCode, message, ex.getCause()); this.statusLine = ex.getStatusLine(); this.response = ex.getResponse(); }
throw new QueryExceptionHTTP(responseCode, "Error making the query, see cause for details", httpEx.getCause());
throw new QueryExceptionHTTP(responseCode, "Error making the query, see cause for details", httpEx.getCause());
private QueryExceptionHTTP rewrap(HttpException httpEx) { // The historical contract of HTTP Queries has been to throw QueryExceptionHTTP however using the standard // ARQ HttpOp machinery we use these days means the internal HTTP errors come back as HttpException // Therefore we need to wrap appropriately responseCode = httpEx.getResponseCode(); if (responseCode != -1) { // Was an actual HTTP error String responseLine = httpEx.getStatusLine() != null ? httpEx.getStatusLine() : "No Status Line"; return new QueryExceptionHTTP(responseCode, "HTTP " + responseCode + " error making the query: " + responseLine, httpEx); } else if (httpEx.getMessage() != null) { // Some non-HTTP error with a valid message e.g. Socket Communications failed, IO error return new QueryExceptionHTTP(responseCode, "Unexpected error making the query: " + httpEx.getMessage(), httpEx); } else if (httpEx.getCause() != null) { // Some other error with a cause e.g. Socket Communications failed, IO error return new QueryExceptionHTTP(responseCode, "Unexpected error making the query, see cause for further details", httpEx); } else { // Some other error with no message and no further cause return new QueryExceptionHTTP(responseCode, "Unexpected error making the query", httpEx); } }