public import os.errors.*;

record GenericIOError(code:Int);

[I | Integer?(I)]
overload GenericIOError(code:I) --> returned:GenericIOError {
    returned.code = Int(code);
}

overload printTo(stream, x:GenericIOError) {
    printTo(stream, "error(", x.code, "): ");
    printErrorMessageTo(stream, x.code);
}

overload printReprTo(stream, x:GenericIOError) {
    printTo(stream, "GenericIOError(", errorCodeName(x.code), ")");
}

variant IOError (GenericIOError);

instance OSError (IOError);

[T | VariantMember?(IOError, T)]
overload Exception(forward x:T) = Exception(IOError(x));
