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

Mono.Unix.UnixMarshal.ThrowExceptionForLastError Method

Throws an exception that best matches the last error returned from Mono.Unix.Native.Stdlib.GetLastError. [Edit]

public static void ThrowExceptionForLastError ()

Exceptions

TypeReason
ArgumentExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.EBADF or Mono.Unix.Native.Errno.EINVAL. [Edit]
ArgumentOutOfRangeExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.ERANGE. [Edit]
InvalidOperationExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.EOPNOTSUPP or Mono.Unix.Native.Errno.EPERM. [Edit]
InvalidProgramExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.ENOEXEC. [Edit]
NullReferenceExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.EFAULT. [Edit]
OverflowExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.EOVERFLOW. [Edit]
UnauthorizedAccessExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.EACCES or Mono.Unix.Native.Errno.EISDIR. [Edit]
System.IO.DirectoryNotFoundExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.ENOTDIR. [Edit]
System.IO.FileNotFoundExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.ENOENT. [Edit]
System.IO.IOExceptionMono.Unix.Native.Stdlib.GetLastError 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. [Edit]
System.IO.PathTooLongExceptionMono.Unix.Native.Stdlib.GetLastError is Mono.Unix.Native.Errno.ENAMETOOLONG. [Edit]
Mono.Unix.UnixIOExceptionMono.Unix.Native.Stdlib.GetLastError is not any of the above error values. [Edit]

Remarks

This is equivalent to calling UnixMarshal.ThrowExceptionForError (Mono.Unix.Native.Stdlib.GetLastError ()).

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.

[Edit]

Requirements

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