Mono Class Library: Mono.Unix.UnixMarshal Overview | Members

Mono.Unix.UnixMarshal.ThrowExceptionForError Method

Throws an exception that best matches errno.

[System.CLSCompliant(false)]
public static void ThrowExceptionForError (Mono.Unix.Native.Errno errno)

Parameters

errno
A Mono.Unix.Native.Errno specifying the exception to throw.

Exceptions

TypeReason
ArgumentExceptionerrno is Mono.Unix.Native.Errno.EBADF or Mono.Unix.Native.Errno.EINVAL.
ArgumentOutOfRangeExceptionerrno is Mono.Unix.Native.Errno.ERANGE.
InvalidOperationExceptionerrno is Mono.Unix.Native.Errno.EOPNOTSUPP or Mono.Unix.Native.Errno.EPERM.
InvalidProgramExceptionerrno is Mono.Unix.Native.Errno.ENOEXEC.
NullReferenceExceptionerrno is Mono.Unix.Native.Errno.EFAULT.
OverflowExceptionerrno is Mono.Unix.Native.Errno.EOVERFLOW.
UnauthorizedAccessExceptionerrno is Mono.Unix.Native.Errno.EACCES or Mono.Unix.Native.Errno.EISDIR.
System.IO.DirectoryNotFoundExceptionerrno is Mono.Unix.Native.Errno.ENOTDIR.
System.IO.FileNotFoundExceptionerrno is Mono.Unix.Native.Errno.ENOENT.
System.IO.IOExceptionerrno is one of: Mono.Unix.Native.Errno.EIO, Mono.Unix.Native.Errno.ENOSPC, Mono.Unix.Native.Errno.ENOTEMPTY, Mono.Unix.Native.Errno.ENXIO, Mono.Unix.Native.Errno.EROFS, Mono.Unix.Native.Errno.ESPIPE.
System.IO.PathTooLongExceptionerrno is Mono.Unix.Native.Errno.ENAMETOOLONG.
Mono.Unix.UnixIOExceptionerrno is not any of the above error values.

Remarks

This method translates errno into its closest matching exception type, and throws the exception.

If the exception thrown is not a Mono.Unix.UnixIOException, then the exception's Exception.InnerException property will be set to a Mono.Unix.UnixIOException instance wrapping errno, if possible.

Note: ArgumentOutOfRangeException does not have its Exception.InnerException property set, as ArgumentOutOfRangeException does not provide a constructor that sets this property.

Requirements

Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0