/** * More information about the error is described in the Stormpath Error Codes documentation * Check http://docs.stormpath.com/errors/ for the list of Stormpath Error Codes * @return the URI to the error documentation */ @Override public String getMoreInfo() { return error.getMoreInfo(); }
/** * Ensures the message used for the exception (i.e. exception.getMessage()) reports the {@code developerMessage} * returned by the Stormpath API Server. The regular Stormpath response body {@code message} field is targeted * at applicadtion end-users that could very likely be non-technical. Since an exception should be helpful to * developers, it is better to show a more technical message. * <p/> * Added as a fix for <a href="https://github.com/stormpath/stormpath-sdk-java/issues/28">Issue #28</a>. * * @param error the response Error. Cannot be null. * @return {@code error.getDeveloperMessage()} * @since 0.9.2 */ private static String buildExceptionMessage(Error error) { Assert.notNull(error, "Error argument cannot be null."); StringBuilder sb = new StringBuilder(); sb.append("HTTP ").append(error.getStatus()) .append(", Stormpath ").append(error.getCode()) .append(" (").append(error.getMoreInfo()).append(")"); String requestId = error.getRequestId(); if (Strings.hasText(requestId)) { sb.append(", RequestId ").append(error.getRequestId()); } return sb.append(": ").append(error.getDeveloperMessage()).toString(); }