浏览代码

[hci] Use http://ipxe.org/<errno> instead of raw error numbers

Users tend to gloss over cryptic-looking error messages such as

  "Boot failed: Exec format error (Error 0x2e852001)"

In particular, users tend not to report the error number, which is the
single most useful piece of diagnostic information in an iPXE error
message.  Try replacing the "Error 0x2e852001" portion with a URL,
giving

  "Boot failed: Exec format error (http://ipxe.org/2e852001)"

in the hope that users will, upon seeing something that is
recognisably a URL, try viewing it in a web browser.  Such users will
be greeted by a web page containing a more detailed description of the
error (automatically generated from the einfo text), including links
to each line of code that might generate the error, and a section for
additional user-contributed notes.  At the time of writing, a user who
visits http://ipxe.org/2e852001 would see a note saying

  "This error usually indicates that the SAN disk is empty, and does
   not yet contain a bootable operating system."

which may be more useful than "Exec format error (Error 0x2e852001)".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 年前
父节点
当前提交
4995ffa438
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5
    2
      src/hci/strerror.c

+ 5
- 2
src/hci/strerror.c 查看文件

@@ -87,10 +87,13 @@ const char * strerror ( int errno ) {
87 87
 
88 88
 	/* Construct the error message */
89 89
 	if ( errortab ) {
90
-		snprintf ( errbuf, sizeof ( errbuf ), "%s (%#08x)",
90
+		snprintf ( errbuf, sizeof ( errbuf ),
91
+			   "%s (http://ipxe.org/%08x)",
91 92
 			   errortab->text, errno );
92 93
 	} else {
93
-		snprintf ( errbuf, sizeof ( errbuf ), "Error %#08x", errno );
94
+		snprintf ( errbuf, sizeof ( errbuf ),
95
+			   "Error %#08x (http://ipxe.org/%08x)",
96
+			   errno, errno );
94 97
 	}
95 98
 
96 99
 	return errbuf;

正在加载...
取消
保存