commit 0367c5c9a256d999d24bd4bda46ca1901c1ff119
parent 3e3b106fce77a680fef59b4d2a0113921d392fed
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 11 Jul 2024 13:08:18 +0200
errors: add netunreachable
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
3 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/errors/common.ha b/errors/common.ha
@@ -40,6 +40,9 @@ export type interrupted = !void;
// The user should attempt an operation again.
export type again = !void;
+// Network unreachable
+export type netunreachable = !void;
+
// A tagged union of all error types.
export type error = !(
busy |
@@ -55,5 +58,6 @@ export type error = !(
nomem |
interrupted |
again |
+ netunreachable |
opaque_
);
diff --git a/errors/rt.ha b/errors/rt.ha
@@ -30,6 +30,8 @@ export fn errno(errno: rt::errno) error = {
return interrupted;
case rt::EAGAIN =>
return again;
+ case rt::ENETUNREACH =>
+ return netunreachable;
case => void;
};
diff --git a/errors/string.ha b/errors/string.ha
@@ -38,6 +38,8 @@ case interrupted =>
yield "Operation interrupted";
case again =>
yield "Try again";
+case netunreachable =>
+ yield "Network unreachable";
case let op: opaque_ =>
yield op.strerror(&op.data);
};