/** * @return never returns. */ public static BadRequestServiceException invalidInput(@NotNull String message) throws BadRequestServiceException { throw new BadRequestServiceException( RestFaultInfoBuilder.faultInfo( FaultInfos.Client.BadRequest.invalidInput(message), Response.Status.BAD_REQUEST ) ); }
@NotNull @Override public Exception translate(@NotNull Throwable t) throws Exception { SoapFaultInfo faultInfo = extractFaultInfo(t); switch (faultInfo.getFaultCause()) { case "BadRequest": throw new BadRequestServiceException(faultInfo); case "AccessDenied": throw new AccessDeniedServiceException(faultInfo); case "Protocol": throw new ProtocolServiceException(faultInfo); case "InternalServerError": throw new InternalServerErrorServiceException(faultInfo); case "ServiceTemporarilyUnavailable": throw new ServiceTemporarilyUnavailableServiceException(faultInfo); case "BadResponse": throw new BadResponseServiceException(faultInfo); default: throw new UnsupportedOperationException("Unhandled case: "+faultInfo.getFaultCause()+"!"); } }
switch (faultInfo.getFaultCause()) { case "BadRequest": return new BadRequestServiceException(faultInfo); case "AccessDenied": return new AccessDeniedServiceException(faultInfo);
String msg = "Failed marshalling object to JSON data for sending to server: "+e.getMessage(); throw new BadRequestServiceException( new RestFaultInfo("BadRequest", Blame.CLIENT, msg, ""+ ErrorCodes.Client.MARSHALLING_FAILED.getCode(), String msg = "Content type \"" + contentType + "\" is not supported."; throw new BadRequestServiceException( new RestFaultInfo("BadRequest", Blame.CLIENT, msg, ""+ ErrorCodes.Client.UNSUPPORTED_TECHNOLOGY.getCode(),
throw e; throw new BadRequestServiceException( new RestFaultInfo("BadRequest", Blame.CLIENT, e.getMessage(), ""+ErrorCodes.Client.BAD_REQUEST.getCode(), String msg = "Unknown method type >>>" + method+"<<<!"; throw new BadRequestServiceException( new RestFaultInfo("BadRequest", Blame.CLIENT, msg, null, switch (faultInfo.getFaultCause()) { case "BadRequest": throw new BadRequestServiceException(faultInfo); case "AccessDenied": throw new AccessDeniedServiceException(faultInfo);