Esempio n. 1
0
 internal static void Success(uv_err_t error)
 {
     var e = Map(error);
     if (e != null) {
         throw e;
     }
 }
Esempio n. 2
0
        internal static Exception Map(uv_err_t error, string name = null)
        {
            if (error.code == uv_err_code.UV_OK)
            {
                return(null);
            }

            switch (error.code)
            {
            case uv_err_code.UV_EINVAL:
                return(new ArgumentException(error.Description));

            case uv_err_code.UV_ENOENT:
                var path = (name == null ? System.IO.Directory.GetCurrentDirectory() : Path.Combine(System.IO.Directory.GetCurrentDirectory(), name));
                return(new System.IO.FileNotFoundException(string.Format("Could not find file '{0}'.", path), path));

            case uv_err_code.UV_EADDRINUSE:
                return(new SocketException(10048));

            case uv_err_code.UV_EADDRNOTAVAIL:
                return(new SocketException(10049));

            case uv_err_code.UV_ECONNREFUSED:
                return(new SocketException(10061));

            default:
                return(new UVException(error));
            }
        }
Esempio n. 3
0
        internal static void Success(uv_err_t error)
        {
            var e = Map(error);

            if (e != null)
            {
                throw e;
            }
        }
        public void End(IntPtr ptr)
        {
            Exception e = null;
            if (Result.ToInt32() == -1) {
                uv_err_t err = new uv_err_t(Error);
                e = Ensure.Map(err, (string.IsNullOrEmpty(Path) ? null : Path));
            }

            if (Callback != null) {
                Callback(e);
            }
            Dispose();
        }
Esempio n. 5
0
        public void End(IntPtr ptr)
        {
            // good idea when you have only the pointer, but no need for it ...
            // var fsr = new FileSystemRequest(ptr, false).Value.Target as FileSystemRequest;
            Exception e = null;
            if (Result.ToInt32() == -1) {
                uv_err_t err = new uv_err_t(Error);
                Callback(Ensure.Map(err), null);
            }

            if (Callback != null) {
                Callback(e, this);
            }
            Dispose();
        }
Esempio n. 6
0
        public void End(IntPtr ptr)
        {
            Exception e = null;

            if (Result.ToInt32() == -1)
            {
                uv_err_t err = new uv_err_t(Error);
                e = Ensure.Map(err, (string.IsNullOrEmpty(Path) ? null : Path));
            }

            if (Callback != null)
            {
                Callback(e);
            }
            Dispose();
        }
Esempio n. 7
0
        public void End(IntPtr ptr)
        {
            // good idea when you have only the pointer, but no need for it ...
            // var fsr = new FileSystemRequest(ptr, false).Value.Target as FileSystemRequest;
            Exception e = null;

            if (Result.ToInt32() == -1)
            {
                uv_err_t err = new uv_err_t(Error);
                Callback(Ensure.Map(err), null);
            }

            if (Callback != null)
            {
                Callback(e, this);
            }
            Dispose();
        }
Esempio n. 8
0
        internal static Exception Map(uv_err_t error, string name = null)
        {
            if (error.code == uv_err_code.UV_OK) {
                return null;
            }

            switch (error.code) {
            case uv_err_code.UV_EINVAL:
                return new ArgumentException(error.Description);
            case uv_err_code.UV_ENOENT:
                var path = (name == null ? System.IO.Directory.GetCurrentDirectory() : Path.Combine(System.IO.Directory.GetCurrentDirectory(), name));
                return new System.IO.FileNotFoundException(string.Format("Could not find file '{0}'.", path), path);
            case uv_err_code.UV_EADDRINUSE:
                return new SocketException(10048);
            case uv_err_code.UV_EADDRNOTAVAIL:
                return new SocketException(10049);
            case uv_err_code.UV_ECONNREFUSED:
                return new SocketException(10061);
            default:
                return new UVException(error);
            }
        }
Esempio n. 9
0
 private static extern sbyte *uv_err_name(uv_err_t error);
Esempio n. 10
0
 private static extern sbyte *uv_strerror(uv_err_t error);
Esempio n. 11
0
 internal UVException(uv_err_t error)
     : this((int)error.code, error.Name, error.Description)
 {
 }
Esempio n. 12
0
		private static extern sbyte *uv_err_name(uv_err_t error);
Esempio n. 13
0
		private static extern sbyte *uv_strerror(uv_err_t error);
Esempio n. 14
0
 internal UVException(uv_err_t error)
     : this((int)error.code, error.Name, error.Description)
 {
 }