commit 1de08b592900661043dd23f662ded0e71b40a11a
parent c38a359051ac8b953fd0ec2b60205854ca737462
Author: Drew DeVault <sir@cmpwn.com>
Date: Tue, 12 Apr 2022 09:58:54 +0200
errors: add eagain
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
3 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/errors/common.ha b/errors/common.ha
@@ -39,6 +39,9 @@ export type nomem = !void;
// An operation was interrupted.
export type interrupted = !void;
+// The user should attempt an operation again.
+export type again = !void;
+
// A tagged union of all error types.
export type error = !(
busy |
@@ -53,5 +56,6 @@ export type error = !(
refused |
nomem |
interrupted |
+ again |
opaque
);
diff --git a/errors/rt.ha b/errors/rt.ha
@@ -26,6 +26,8 @@ export fn errno(errno: rt::errno) error = {
return busy;
case rt::EINTR =>
return interrupted;
+ case rt::EAGAIN =>
+ return again;
case => void;
};
diff --git a/errors/string.ha b/errors/string.ha
@@ -35,6 +35,10 @@ case refused =>
yield "A connection attempt was refused";
case nomem =>
yield "Unable to allocate sufficient memory for the requested operation";
+case interrupted =>
+ yield "Operation interrupted";
+case again =>
+ yield "Try again";
case let op: opaque =>
yield op.strerror(&op.data);
};