Beispiel #1
0
        public RpcException CreateException()
        {
            RpcException exception;

            switch ((RpcErrorCode)this.Code)
            {
            case RpcErrorCode.ParseError:
                exception = new RpcParseException(this);
                break;

            case RpcErrorCode.InvalidRequest:
                exception = new RpcInvalidRequestException(this);
                break;

            case RpcErrorCode.MethodNotFound:
                exception = new RpcMethodNotFoundException(this);
                break;

            case RpcErrorCode.InvalidParams:
                exception = new RpcInvalidParametersException(this);
                break;

            case RpcErrorCode.InternalError:
                exception = new RpcInvalidParametersException(this);
                break;

            default:
                exception = new RpcCustomException(this);
                break;
            }
            return(exception);
        }
Beispiel #2
0
        public RpcException CreateException()
        {
            RpcException exception;

            switch (this.Code)
            {
            case RpcErrorCode.ParseError:
                exception = new RpcParseException(this);
                break;

            case RpcErrorCode.InvalidRequest:
                exception = new RpcInvalidRequestException(this);
                break;

            case RpcErrorCode.MethodNotFound:
                exception = new RpcMethodNotFoundException(this);
                break;

            case RpcErrorCode.InvalidParams:
                exception = new RpcInvalidParametersException(this);
                break;

            case RpcErrorCode.InternalError:
                exception = new RpcInvalidParametersException(this);
                break;

            case RpcErrorCode.AmbiguousMethod:
                exception = new RpcAmbiguousMethodException(this);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(exception);
        }