internal ErrorResponse(ResponseFrame frame) : base(frame)
        {
            var ctype   = (CassandraErrorType)BEBinaryReader.ReadInt32();
            var message = BEBinaryReader.ReadString();

            Output = OutputError.CreateOutputError(ctype, message, BEBinaryReader);
        }
Esempio n. 2
0
        internal ErrorResponse(Frame frame)
            : base(frame)
        {
            int    errorCode = Reader.ReadInt32();
            string message   = Reader.ReadString();

            Output = OutputError.CreateOutputError(errorCode, message, Reader);
        }
        public void Should_Throw_Helpful_Exception_On_Unknown_Error_Code()
        {
            int         unknownCode    = int.MaxValue;
            string      unknownMessage = "This message should be included in the exception";
            FrameReader frameReader    = null; // This isn't currently needed to reproduce so set as null

            // Make sure we get an exception
            var caught = Assert.Catch <DriverInternalError>(() => OutputError.CreateOutputError(unknownCode, unknownMessage, frameReader));

            // Verify the exception message contains the code and the message from the server
            Assert.True(caught.Message.Contains(unknownCode.ToString()));
            Assert.True(caught.Message.Contains(unknownMessage));
        }