Esempio n. 1
0
        public NngException(NngErrorCode errorCode)
        {
            var ptr = NativeMethods.nng_strerror(errorCode);

            Message   = Marshal.PtrToStringAnsi(ptr);
            ErrorCode = errorCode;
        }
Esempio n. 2
0
        public void GetMessage(NngErrorCode errorCode, string expectedMessage)
        {
            // note: this test does not have any value except to figure out what NNG error code names stand for (as in NNG_ETRANERR)
            var exception = new NngException(errorCode);

            Assert.Equal(expectedMessage, exception.Message);
        }
Esempio n. 3
0
        public static void ThrowIfError(this NngErrorCode errorCode)
        {
            switch (errorCode)
            {
            case NngErrorCode.Success: return;

            case NngErrorCode.Unknown: throw new InvalidOperationException("Error code was not set by NNG");

            case NngErrorCode.TimedOut: throw new TimeoutException();

            default: throw new NngException(errorCode);
            }
        }
Esempio n. 4
0
 public static extern IntPtr nng_strerror(NngErrorCode errorCode);