ErrnoException

Thrown if errors that set errno occur.

Constructors

this
this(string msg, string file, size_t line)

Constructor which takes an error message. The current global core.stdc.errno.errno value is used as error code.

this
this(string msg, int errno, string file, size_t line)

Constructor which takes an error message and error code.

Members

Properties

errno
uint errno [@property getter]

Operating system error code.

errnoMsg
string errnoMsg [@property getter]

Localized error message generated through core.stdc.string.strerror_r or core.stdc.string.strerror.

Examples

import core.stdc.errno : EAGAIN;
auto ex = new ErrnoException("oh no", EAGAIN);
assert(ex.errno == EAGAIN);

errno is used by default if no explicit error code is provided

import core.stdc.errno : errno, EAGAIN;

auto old = errno;
scope(exit) errno = old;

// fake that errno got set by the callee
errno = EAGAIN;
auto ex = new ErrnoException("oh no");
assert(ex.errno == EAGAIN);

Meta