commit 7ada774bc81f2c0a569f00a1b1d9e01a80bcedf1 parent 321d779f6d986e333743345d8c0ad45838fae226 Author: Sebastian <sebastian@sebsite.pw> Date: Fri, 15 Apr 2022 18:48:08 -0400 hare::types: add strerror Signed-off-by: Sebastian <sebastian@sebsite.pw> Diffstat:
M | hare/types/store.ha | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/hare/types/store.ha b/hare/types/store.ha @@ -66,6 +66,14 @@ export type noresolver = !void; // All possible errors for [[lookup]]. export type error = !(noresolver | errors::opaque); +// Convert an error into a human-friendly string. +export fn strerror(err: error) const str = match (err) { +case noresolver => + return "Resolver function not provided, but required"; +case let err: errors::opaque => + return errors::strerror(err); +}; + // Retrieves a [[_type]] for a given [[hare::ast::_type]]. export fn lookup( store: *typestore,