コード例 #1
0
        public static byte[] SerializeManagementExceptionResponse(Exception exc, long requestId)
        {
            Alachisoft.NCache.Common.Protobuf.Exception ex = GetExceptionResponse(exc);

            Alachisoft.NCache.Common.Protobuf.ManagementResponse response = new ManagementResponse();
            response.requestId = requestId;
            response.exception = ex;

            return(SerializeResponse(response));
        }
コード例 #2
0
        public static byte[] SerializeExceptionResponse(Exception exc, long requestId)
        {
            Alachisoft.NCache.Common.Protobuf.Exception ex = GetExceptionResponse(exc);

            Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
            response.requestId    = requestId;
            response.exception    = ex;
            response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.EXCEPTION;

            return(SerializeResponse(response));
        }
コード例 #3
0
        public static byte[] SerializeExceptionResponse(Exception exc, long requestId)
        {
            Alachisoft.NCache.Common.Protobuf.Exception ex = new Alachisoft.NCache.Common.Protobuf.Exception();
            ex.message   = exc.Message;
            ex.exception = exc.ToString();
            if (exc is InvalidReaderException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.INVALID_READER_EXCEPTION;
            }
            else if (exc is OperationFailedException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.OPERATIONFAILED;
            }
            else if (exc is Runtime.Exceptions.AggregateException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.AGGREGATE;
            }
            else if (exc is ConfigurationException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.CONFIGURATION;
            }
            else if (exc is OperationNotSupportedException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.NOTSUPPORTED;
            }

            else if (exc is TypeIndexNotDefined)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.TYPE_INDEX_NOT_FOUND;
            }
            else if (exc is AttributeIndexNotDefined)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.ATTRIBUTE_INDEX_NOT_FOUND;
            }
            else if (exc is StateTransferInProgressException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STATE_TRANSFER_EXCEPTION;
            }
            else
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.GENERALFAILURE;
            }

            Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
            response.requestId    = requestId;
            response.exception    = ex;
            response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.EXCEPTION;

            return(SerializeResponse(response));
        }
コード例 #4
0
        private static Protobuf.Exception GetExceptionResponse(Exception exc)
        {
            Alachisoft.NCache.Common.Protobuf.Exception ex = new Alachisoft.NCache.Common.Protobuf.Exception();
            ex.message   = exc.Message;
            ex.exception = exc.ToString();

            if (exc is OperationFailedException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.OPERATIONFAILED;
            }
            else if (exc is Runtime.Exceptions.AggregateException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.AGGREGATE;
            }
            else if (exc is ConfigurationException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.CONFIGURATION;
            }
            else if (exc is OperationNotSupportedException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.NOTSUPPORTED;
            }
            else if (exc is TypeIndexNotDefined)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.TYPE_INDEX_NOT_FOUND;
            }
            else if (exc is AttributeIndexNotDefined)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.ATTRIBUTE_INDEX_NOT_FOUND;
            }
            else if (exc is StateTransferInProgressException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STATE_TRANSFER_EXCEPTION;
            }
            else
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.GENERALFAILURE;
            }
            return(ex);
        }
コード例 #5
0
ファイル: ResponseHelper.cs プロジェクト: javithalion/NCache
        private static Protobuf.Exception GetExceptionResponse(Exception exc)
        {
            Alachisoft.NCache.Common.Protobuf.Exception ex = new Alachisoft.NCache.Common.Protobuf.Exception();
            ex.message = exc.Message;
            ex.exception = exc.ToString();

            if (exc is OperationFailedException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.OPERATIONFAILED;
            else if (exc is Runtime.Exceptions.AggregateException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.AGGREGATE;
            else if (exc is ConfigurationException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.CONFIGURATION;
            else if (exc is OperationNotSupportedException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.NOTSUPPORTED;
            else if (exc is TypeIndexNotDefined)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.TYPE_INDEX_NOT_FOUND;
            else if (exc is AttributeIndexNotDefined)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.ATTRIBUTE_INDEX_NOT_FOUND;
            else if (exc is StateTransferInProgressException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STATE_TRANSFER_EXCEPTION;
            else
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.GENERALFAILURE;
            return ex;
        }
コード例 #6
0
        public static IList SerializeExceptionResponse(Exception exc, long requestId, int commandID)

        {
            Alachisoft.NCache.Common.Protobuf.Exception ex = new Alachisoft.NCache.Common.Protobuf.Exception();
            ex.message   = exc.Message;
            ex.exception = exc.ToString();
            if (exc is InvalidReaderException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.INVALID_READER_EXCEPTION;
            }
            else if (exc is OperationFailedException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.OPERATIONFAILED;
            }
            else if (exc is Runtime.Exceptions.AggregateException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.AGGREGATE;
            }
            else if (exc is ConfigurationException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.CONFIGURATION;
            }

            else if (exc is VersionException)
            {
                VersionException tempEx = (VersionException)exc;
                ex.type      = Alachisoft.NCache.Common.Protobuf.Exception.Type.CONFIGURATON_EXCEPTION;
                ex.errorCode = tempEx.ErrorCode;
            }
            else if (exc is OperationNotSupportedException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.NOTSUPPORTED;
            }
            else if (exc is StreamAlreadyLockedException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STREAM_ALREADY_LOCKED;
            }
            else if (exc is StreamCloseException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STREAM_CLOSED;
            }
            else if (exc is StreamInvalidLockException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STREAM_INVALID_LOCK;
            }
            else if (exc is StreamNotFoundException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STREAM_NOT_FOUND;
            }
            else if (exc is StreamException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STREAM_EXC;
            }
            else if (exc is TypeIndexNotDefined)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.TYPE_INDEX_NOT_FOUND;
            }
            else if (exc is AttributeIndexNotDefined)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.ATTRIBUTE_INDEX_NOT_FOUND;
            }
            else if (exc is StateTransferInProgressException)
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STATE_TRANSFER_EXCEPTION;
            }
            else
            {
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.GENERALFAILURE;
            }

            Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
            response.requestId = requestId;

            response.commandID    = commandID;
            response.exception    = ex;
            response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.EXCEPTION;

            return(SerializeResponse(response));
        }