Package com.betfair.cougar.core.api.fault

Examples of com.betfair.cougar.core.api.fault.Fault


    private JsonRpcResponse buildExecutionResultResponse(JsonRpcRequest rpc, ExecutionResult executionResult) {
        JsonRpcResponse response = null;
        if (executionResult.getResultType() == ExecutionResult.ResultType.Success) {
            response = JsonRpcSuccessResponse.buildSuccessResponse(rpc, executionResult.getResult());
        } else if (executionResult.getResultType() == ExecutionResult.ResultType.Fault) {
            Fault fault = executionResult.getFault().getFault();
            HashMap<String,Object> detailMap = new HashMap<String,Object>();
            FaultDetail detail = fault.getDetail();
            if (FaultController.getInstance().isDetailedFaults()) {
                detailMap.put("trace", detail.getStackTrace());
                detailMap.put("message", detail.getDetailMessage());
            }
            List<String[]> faultMessages = detail.getFaultMessages();
            if (faultMessages != null) {
                detailMap.put("exceptionname", detail.getFaultName());
                HashMap<String,Object> paramMap = new HashMap<String,Object>();
                detailMap.put(detail.getFaultName(), paramMap);
                for (String[] msg: faultMessages) {
                    paramMap.put(msg[0], msg[1]);
                }
            }

            int jsonErrorCode = mapServerFaultCodeToJsonErrorCode(executionResult.getFault().getServerFaultCode());
            JsonRpcError error = new JsonRpcError(jsonErrorCode, fault.getErrorCode(), !detailMap.isEmpty() ? detailMap : null);

            response = JsonRpcErrorResponse.buildErrorResponse(rpc, error);
        }
        return response;
    }
View Full Code Here


    }
    CougarLoggingUtils.getLogger(getClass()).log(level, "Exception thrown: ", this);
  }
 
  public Fault getFault() {
    return new Fault(getResponseCode().getFaultCode(), serverFault.getDetail(), getMessage(), getCause());
  }
View Full Code Here

    super(Level.FINE, fault, message, t);
  }
 
  @Override
  public Fault getFault() {
    Fault fault = null;
      if (dae != null) {
        fault = new Fault(dae.getResponseCode().getFaultCode(), dae.getExceptionCode(), dae.getClass().getSimpleName(), dae);
      } else {
        fault = super.getFault();
      }
      return fault;
  }
View Full Code Here

    super(Level.FINE, fault, message, t);
  }

  @Override
  public Fault getFault() {
    Fault fault = null;
      if (dae != null) {
        fault = new Fault(dae.getResponseCode().getFaultCode(), dae.getExceptionCode(), dae.getClass().getSimpleName(), dae);
      } else {
        fault = super.getFault();
      }
      return fault;
  }
View Full Code Here

    }
    CougarLoggingUtils.getLogger(getClass()).log(level, "Exception thrown: ", this);
  }

  public Fault getFault() {
    return new Fault(getResponseCode().getFaultCode(), serverFault.getDetail(), getMessage(), getCause());
  }
View Full Code Here

        this.confirmedAsCougar = confirmedAsCougar;
  }

  @Override
  public Fault getFault() {
    Fault fault = null;
      if (dae != null) {
        fault = new Fault(dae.getResponseCode().getFaultCode(), dae.getExceptionCode(), dae.getClass().getSimpleName(), dae);
      } else {
        fault = super.getFault();
      }
      return fault;
  }
View Full Code Here

    private JsonRpcResponse buildExecutionResultResponse(JsonRpcRequest rpc, ExecutionResult executionResult) {
        JsonRpcResponse response = null;
        if (executionResult.getResultType() == ExecutionResult.ResultType.Success) {
            response = JsonRpcSuccessResponse.buildSuccessResponse(rpc, executionResult.getResult());
        } else if (executionResult.getResultType() == ExecutionResult.ResultType.Fault) {
            Fault fault = executionResult.getFault().getFault();
            HashMap<String,Object> detailMap = new HashMap<String,Object>();
            FaultDetail detail = fault.getDetail();
            if (FaultController.getInstance().isDetailedFaults()) {
                detailMap.put("trace", detail.getStackTrace());
                detailMap.put("message", detail.getDetailMessage());
            }
            List<String[]> faultMessages = detail.getFaultMessages();
            if (faultMessages != null) {
                detailMap.put("exceptionname", detail.getFaultName());
                HashMap<String,Object> paramMap = new HashMap<String,Object>();
                detailMap.put(detail.getFaultName(), paramMap);
                for (String[] msg: faultMessages) {
                    paramMap.put(msg[0], msg[1]);
                }
            }

            int jsonErrorCode = mapServerFaultCodeToJsonErrorCode(executionResult.getFault().getServerFaultCode());
            JsonRpcError error = new JsonRpcError(jsonErrorCode, fault.getErrorCode(), !detailMap.isEmpty() ? detailMap : null);

            response = JsonRpcErrorResponse.buildErrorResponse(rpc, error);
        }
        return response;
    }
View Full Code Here

TOP

Related Classes of com.betfair.cougar.core.api.fault.Fault

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.