internal static Exception CreateExceptionForError(Native.Errno errno) { string message = GetErrorDescription(errno); UnixIOException p = new UnixIOException(errno); // Ordering: Order alphabetically by exception first (right column), // then order alphabetically by Errno value (left column) for the given // exception. switch (errno) { case Native.Errno.EBADF: case Native.Errno.EINVAL: return(new ArgumentException(message, p)); case Native.Errno.ERANGE: return(new ArgumentOutOfRangeException(message)); case Native.Errno.ENOTDIR: return(new DirectoryNotFoundException(message, p)); case Native.Errno.ENOENT: return(new FileNotFoundException(message, p)); case Native.Errno.EOPNOTSUPP: case Native.Errno.EPERM: return(new InvalidOperationException(message, p)); case Native.Errno.ENOEXEC: return(new InvalidProgramException(message, p)); case Native.Errno.EIO: case Native.Errno.ENOSPC: case Native.Errno.ENOTEMPTY: case Native.Errno.ENXIO: case Native.Errno.EROFS: case Native.Errno.ESPIPE: return(new IOException(message, p)); case Native.Errno.EFAULT: return(new NullReferenceException(message, p)); case Native.Errno.EOVERFLOW: return(new OverflowException(message, p)); case Native.Errno.ENAMETOOLONG: return(new PathTooLongException(message, p)); case Native.Errno.EACCES: case Native.Errno.EISDIR: return(new UnauthorizedAccessException(message, p)); default: /* ignore */ break; } return(p); }
internal static Exception CreateExceptionForError(Native.Errno errno) { string message = GetErrorDescription (errno); UnixIOException p = new UnixIOException (errno); // Ordering: Order alphabetically by exception first (right column), // then order alphabetically by Errno value (left column) for the given // exception. switch (errno) { case Native.Errno.EBADF: case Native.Errno.EINVAL: return new ArgumentException (message, p); case Native.Errno.ERANGE: return new ArgumentOutOfRangeException (message); case Native.Errno.ENOTDIR: return new DirectoryNotFoundException (message, p); case Native.Errno.ENOENT: return new FileNotFoundException (message, p); case Native.Errno.EOPNOTSUPP: case Native.Errno.EPERM: return new InvalidOperationException (message, p); case Native.Errno.ENOEXEC: return new InvalidProgramException (message, p); case Native.Errno.EIO: case Native.Errno.ENOSPC: case Native.Errno.ENOTEMPTY: case Native.Errno.ENXIO: case Native.Errno.EROFS: case Native.Errno.ESPIPE: return new IOException (message, p); case Native.Errno.EFAULT: return new NullReferenceException (message, p); case Native.Errno.EOVERFLOW: return new OverflowException (message, p); case Native.Errno.ENAMETOOLONG: return new PathTooLongException (message, p); case Native.Errno.EACCES: case Native.Errno.EISDIR: return new UnauthorizedAccessException (message, p); default: /* ignore */ break; } return p; }
internal static Exception CreateExceptionForError(Errno errno) { string errorDescription = UnixMarshal.GetErrorDescription(errno); UnixIOException unixIOException = new UnixIOException(errno); Errno errno1 = errno; switch (errno1) { case Errno.EPERM: { return(new InvalidOperationException(errorDescription, unixIOException)); } case Errno.ENOENT: { return(new FileNotFoundException(errorDescription, unixIOException)); } case Errno.EIO: case Errno.ENXIO: { return(new IOException(errorDescription, unixIOException)); } case Errno.ENOEXEC: { return(new InvalidProgramException(errorDescription, unixIOException)); } case Errno.EBADF: case Errno.EINVAL: { return(new ArgumentException(errorDescription, unixIOException)); } case Errno.EACCES: case Errno.EISDIR: { return(new UnauthorizedAccessException(errorDescription, unixIOException)); } case Errno.EFAULT: { return(new NullReferenceException(errorDescription, unixIOException)); } case Errno.ENOTDIR: { return(new DirectoryNotFoundException(errorDescription, unixIOException)); } default: { switch (errno1) { case Errno.ENOSPC: case Errno.ESPIPE: case Errno.EROFS: case Errno.ENOTEMPTY: { return(new IOException(errorDescription, unixIOException)); } case Errno.ERANGE: { return(new ArgumentOutOfRangeException(errorDescription)); } case Errno.ENAMETOOLONG: { return(new PathTooLongException(errorDescription, unixIOException)); } default: { if (errno1 == Errno.EOVERFLOW) { return(new OverflowException(errorDescription, unixIOException)); } if (errno1 == Errno.EOPNOTSUPP) { return(new InvalidOperationException(errorDescription, unixIOException)); } return(unixIOException); } } break; } } }
internal static Exception CreateExceptionForError (Error errno) { string message = GetErrorDescription (errno); UnixIOException p = new UnixIOException (errno); switch (errno) { case Error.EFAULT: return new NullReferenceException (message, p); case Error.EINVAL: return new ArgumentException (message, p); case Error.EIO: case Error.ENOSPC: case Error.EROFS: case Error.ESPIPE: return new IOException (message, p); case Error.ENAMETOOLONG: return new PathTooLongException (message, p); case Error.ENOENT: return new FileNotFoundException (message, p); case Error.ENOEXEC: return new InvalidProgramException (message, p); case Error.EOVERFLOW: return new OverflowException (message, p); case Error.ERANGE: return new ArgumentOutOfRangeException (message); default: /* ignore */ break; } return p; }
public UnixIOException(Errno errno, Exception inner) : base(UnixIOException.GetMessage(errno), inner) { this.errno = NativeConvert.FromErrno(errno); }
public UnixIOException(int errno, Exception inner) : base(UnixIOException.GetMessage(NativeConvert.ToErrno(errno)), inner) { this.errno = errno; }