SystemErrorCode

A tagged union that holds an error code from system apis, meaning one from Windows GetLastError() or C's errno.

You construct it with SystemErrorCode(thing) and the overloaded constructor tags and stores it.

Constructors

this
this(int errno)
this(uint win32)

C/unix error are typed as signed ints... Windows' errors are typed DWORD, aka unsigned...

Members

Enums

Type
enum Type

Functions

codeAsString
string codeAsString()

The numeric code itself as a string.

errorString
string errorString()

A text explanation of the code. See codeAsString for a string representation of the numeric representation.

toString
string toString()

Constructs a string containing both the code and the explanation string.

wasSuccessful
bool wasSuccessful()

Returns if the code indicated success.

Variables

code
int code;

You should technically cast it back to DWORD if it is a win32 code

type
Type type;

Meta