commit 2e82fa4ccb4d51c43f515f320d5c4265f2f0f59e
parent b2cc6555cfa46c2b21196f402559989332fdb1ac
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 7 Sep 2024 16:29:09 -0400
haredoc: handle path::too_long
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/cmd/haredoc/main.ha b/cmd/haredoc/main.ha
@@ -220,7 +220,7 @@ fn doc(name: str, cmd: *getopt::command) (void | error) = {
const ambiguous = modpath != "" && len(decls) > 0;
- if (len(decls) == 0) {
+ if (len(decls) == 0) :nodecls {
for (let ha .. modsrcs.ha) {
let d = match (doc::scan(ha)) {
case let d: []ast::decl =>
@@ -242,7 +242,13 @@ fn doc(name: str, cmd: *getopt::command) (void | error) = {
append(decls, d...);
};
- const rpath = path::init(modpath, "README")!;
+ const rpath = match (path::init(modpath, "README")) {
+ case let buf: path::buffer =>
+ yield buf;
+ case let err: path::error =>
+ assert(err is path::too_long);
+ yield :nodecls;
+ };
match (os::open(path::string(&rpath))) {
case let f: io::file =>
readme = f;