errors.ha (516B)
1 // License: MPL-2.0 2 // (c) 2023 Byron Torres <b@torresjrjr.com> 3 4 // All possible errors returned from [[datetime]]. 5 export type error = !(insufficient | invalid | parsefail); 6 7 // Converts an [[error]] into a human-friendly string. 8 export fn strerror(err: error) const str = { 9 match (err) { 10 case insufficient => 11 return "Insufficient datetime information"; 12 case invalid => 13 return "Invalid datetime information"; 14 case let rn: parsefail => 15 // TODO: use rune 'rn' here 16 return "Datetime parsing error"; 17 }; 18 };