hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

errors.ha (557B)


      1 // SPDX-License-Identifier: MPL-2.0
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 use errors;
      5 use io;
      6 
      7 // An attempt was made to use an unsupported protocol.
      8 export type unknownproto = !void;
      9 
     10 // All error types which can be returned from networking functions.
     11 export type error = !(unknownproto | ...errors::error);
     12 
     13 // Converts an [[error]] into a human-readable string.
     14 export fn strerror(err: error) const str = {
     15 	match (err) {
     16 	case unknownproto =>
     17 		return "Unsupported protocol";
     18 	case let err: errors::error =>
     19 		return errors::strerror(err);
     20 	};
     21 };