hare

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

errors.ha (549B)


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