hare

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

error.ha (803B)


      1 // SPDX-License-Identifier: MPL-2.0
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 // Returned when adding an extension if the path is root, or the final path
      5 // segment consists entirely of dots.
      6 export type cant_extend = !void;
      7 // Returned when a path buffer would have overflowed.
      8 export type too_long = !void;
      9 // Returned when [[trimprefix]] receives a prefix that is not present.
     10 export type not_prefix = !void;
     11 // Represents an error during a path manipulation
     12 export type error = !(cant_extend | too_long | not_prefix);
     13 
     14 // Convert an [[error]] into a descriptive string.
     15 export fn strerror(e: error) str = match (e) {
     16 case cant_extend => return "Can't add extension (filename is root or all dots)";
     17 case too_long => return "Path buffer overflow";
     18 case not_prefix => return "Prefix not present";
     19 };