Package com.betfair.cougar.core.api.exception

Examples of com.betfair.cougar.core.api.exception.ServerFaultCode


            try {
                Object[] args = mf.parse(toParse);
                String result = mf.format(args);
                if (result.equals(toParse)) {
                    // we've found the key, if we have a mapping then return the appropriate exception, otherwise no point continuing
                    ServerFaultCode sfc = faultCodes.get(key);
                    if (sfc != null) {
                        return new CougarValidationException(sfc, spe);
                    }
                    return null;
                }
View Full Code Here


            }
        };
        request.onResponseFailure(new Response.FailureListener() {
            @Override
            public void onFailure(Response response, Throwable failure) {
                ServerFaultCode faultCode = ServerFaultCode.RemoteCougarCommunicationFailure;
                if (failure instanceof TimeoutException) {
                    failure = new CougarFrameworkException("Read timed out", failure);
                    faultCode = ServerFaultCode.Timeout;
                }
                LOGGER.warn("COUGAR: HTTP communication ERROR - URL [" + url + "] time [" + elapsed(startTime) + "mS]", failure);
View Full Code Here

                try {
                    identityResolver.resolve(chain, contextWithTokens);
                }
                catch (InvalidCredentialsException e) {
                    if (e.getCredentialFaultCode() != null) { // Check if a custom error code should be used
                        ServerFaultCode sfc = ServerFaultCode.getByCredentialFaultCode(e.getCredentialFaultCode());
                        throw new CougarFrameworkException(sfc, "Credentials supplied were invalid", e);
                    }
                    throw new CougarFrameworkException(ServerFaultCode.SecurityException, "Credentials supplied were invalid", e);
                }
                // ensure the identity chain set in the context is immutable
View Full Code Here

              //A void return type is still marked by a value (which signifies null) on the wire, see
              //TranscriptionStreamFactoryImpl for details
        Object result = in.readObject();
        return new InvocationResponseImpl(result);
      } else {
        ServerFaultCode code = (ServerFaultCode)in.readObject();
        FaultDetail faultDetail = (FaultDetail) in.readObject();
        if (faultDetail != null) {
                  if (faultDetail.getCause() != null) {
                      if (faultDetail.getCause() instanceof CougarApplicationException) {
                          return new InvocationResponseImpl(null, new CougarClientException(code, faultDetail.getDetailMessage(), (CougarApplicationException)faultDetail.getCause()));
                      } else {
                          return new InvocationResponseImpl(null, new CougarClientException(code, faultDetail.getDetailMessage(), faultDetail.getCause()));
                      }
                  }
                  else {
                        FaultCode faultCode = code == ServerFaultCode.ServiceCheckedException ? FaultCode.Server : code.getResponseCode().getFaultCode();
                      return new InvocationResponseImpl(null, new CougarClientException(code, faultCode + " fault received from remote server: "+code,
                                new CougarClientException(code, faultDetail.getDetailMessage())
                        ));
                  }
        }
View Full Code Here

                try {
                    identityResolver.resolve(chain, contextWithTokens);
                }
                catch (InvalidCredentialsException e) {
                    if (e.getCredentialFaultCode() != null) { // Check if a custom error code should be used
                        ServerFaultCode sfc = ServerFaultCode.getByCredentialFaultCode(e.getCredentialFaultCode());
                        throw new CougarServiceException(sfc, "Credentials supplied were invalid", e);
                    }
                    throw new CougarServiceException(ServerFaultCode.SecurityException, "Credentials supplied were invalid", e);
                }
                // ensure the identity chain set in the context is immutable
View Full Code Here

            }
        };
        request.onResponseFailure(new Response.FailureListener() {
            @Override
            public void onFailure(Response response, Throwable failure) {
                ServerFaultCode serverFaultCode = ServerFaultCode.RemoteCougarCommunicationFailure;
                if (failure instanceof TimeoutException) {
                    failure = new CougarFrameworkException("Read timed out", failure);
                    serverFaultCode = ServerFaultCode.Timeout;
                }
                LOGGER.warn("COUGAR: HTTP communication ERROR - URL [" + url + "] time [" + elapsed(startTime) + "mS]", failure);
View Full Code Here

              //A void return type is still marked by a value (which signifies null) on the wire, see
              //TranscriptionStreamFactoryImpl for details
        Object result = in.readObject();
        return new InvocationResponseImpl(result);
      } else {
        ServerFaultCode code = (ServerFaultCode)in.readObject();
        FaultDetail faultDetail = (FaultDetail) in.readObject();
        if (faultDetail != null) {
                  if (faultDetail.getCause() != null) {
                      if (faultDetail.getCause() instanceof CougarApplicationException) {
                          return new InvocationResponseImpl(null, new CougarServiceException(code, faultDetail.getDetailMessage(), (CougarApplicationException)faultDetail.getCause()));
                      } else {
                          return new InvocationResponseImpl(null, new CougarServiceException(code, faultDetail.getDetailMessage(), faultDetail.getCause()));
                      }
                  }
                  else {
                        FaultCode faultCode = code == ServerFaultCode.ServiceCheckedException ? FaultCode.Server : code.getResponseCode().getFaultCode();
                      return new InvocationResponseImpl(null, new CougarServiceException(code, faultCode + " fault received from remote server: "+code,
                                new CougarServiceException(code, faultDetail.getDetailMessage())
                        ));
                  }
        }
View Full Code Here

            try {
                Object[] args = mf.parse(toParse);
                String result = mf.format(args);
                if (result.equals(toParse)) {
                    // we've found the key, if we have a mapping then return the appropriate exception, otherwise no point continuing
                    ServerFaultCode sfc = faultCodes.get(key);
                    if (sfc == null && deserialisationFailures.contains(key)) {
                        return CougarMarshallingException.unmarshallingException(format, spe.getMessage(), spe, client);
                    }
                    if (sfc != null) {
                        return new CougarValidationException(sfc, spe);
View Full Code Here

    public AbstractExceptionFactory() {
        //Registers the CougarException exception instantiator...
        registerExceptionInstantiator(ServerFaultCode.COUGAR_EXCEPTION_PREFIX, new ExceptionInstantiator() {
            @Override
            public Exception createException(ResponseCode responseCode, String prefix, String reason, Map<String,String> exceptionParams) {
                ServerFaultCode sfc = ServerFaultCode.getByDetailCode(prefix);
                return new CougarClientException(sfc, reason);
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.betfair.cougar.core.api.exception.ServerFaultCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.