Plan 9 from Bell Labs’s /usr/web/sources/contrib/mospak/abaco-modern/abaco-error-surface-prefix.patch

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


abaco: mark failed fetches "error:" in status line

abaco's status area (updated through addrefresh() in util.c:1148)
carries both in-flight progress and terminal-failure messages
through the same format, giving them no visual distinction.
Progress reads "opening: URL..." / "loading: URL..." /
"loading frames..." / "loading images...".  Failures read
"URL: errmsg" (urlopen failure, page.c:276) or "URL: unsupported
mime type: 'ctype'" (unknown content-type, page.c:296).  A user
glancing at the status cannot tell in-flight from failed.

Fix: prefix the two failure-path messages with "error: ".  The
successful paths already lead with a verb+colon ("opening:",
"loading:"), so the "error:" prefix parallels that idiom — status
lines sort into two readable shapes:

	opening: URL...                    in flight
	loading: URL...                    in flight
	error: URL: errmsg                 failed (network / TLS / 404)
	error: URL: unsupported mime type  failed (unhandled content-type)

Two lines touched, no new callers, no new subsystems.  The
empty-string clear after successful load ("") is unchanged.

RFC relevance: none

--- sys/src/cmd/abaco/page.c
+++ sys/src/cmd/abaco/page.c
@@ -273,7 +273,7 @@
 	addrefresh(p, "opening: %S...", p->url->src.r);
 	fd = urlopen(p->url);
 	if(fd < 0){
-		addrefresh(p, "%S: %r", p->url->src.r);
+		addrefresh(p, "error: %S: %r", p->url->src.r);
     Err:
 		p->loading = FALSE;
 		return;
@@ -293,7 +293,7 @@
 		ctype = TextPlain;
 	else{
 		close(fd);
-		addrefresh(p, "%S: unsupported mime type: '%S'", p->url->act.r, p->url->ctype.r);
+		addrefresh(p, "error: %S: unsupported mime type: '%S'", p->url->act.r, p->url->ctype.r);
 		goto Err;
 	}
 	addrefresh(p, "loading: %S...", p->url->src.r);

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.