Browse Source

[build] Allow error message URI to be customised via config/branding.h

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
eac445b650
2 changed files with 48 additions and 2 deletions
  1. 45
    0
      src/config/branding.h
  2. 3
    2
      src/hci/strerror.c

+ 45
- 0
src/config/branding.h View File

@@ -28,6 +28,51 @@ FILE_LICENCE ( GPL2_OR_LATER );
28 28
 #define PRODUCT_SHORT_NAME "iPXE"
29 29
 #define PRODUCT_URI "http://ipxe.org"
30 30
 
31
+/*
32
+ * Error messages
33
+ *
34
+ * iPXE error messages comprise a summary error message
35
+ * (e.g. "Permission denied") and a 32-bit error number.  This number
36
+ * is incorporated into an error URI such as
37
+ *
38
+ *   "No such file or directory (http://ipxe.org/2d0c613b)"
39
+ *
40
+ * or
41
+ *
42
+ *   "Operation not supported (http://ipxe.org/3c092003)"
43
+ *
44
+ * Users may browse to the URI within the error message, which is
45
+ * provided by a database running on the iPXE web site
46
+ * (http://ipxe.org).  This database provides details for all possible
47
+ * errors generated by iPXE, including:
48
+ *
49
+ * - the detailed error message (e.g. "Not an OCSP signing
50
+ *   certificate") to complement the summary message (e.g. "Permission
51
+ *   denied") which is compiled into the iPXE binary.
52
+ *
53
+ * - an instruction to the user to upgrade, if the error cannot be
54
+ *   generated by the latest version of iPXE.
55
+ *
56
+ * - hints on how to fix the error (e.g. "This error indicates that
57
+ *   the file was not found on the TFTP server.  Check that you can
58
+ *   retrieve the file using an alternative TFTP client, such as
59
+ *   tftp-hpa on Linux.")
60
+ *
61
+ * - details of which source file within the iPXE codebase generated
62
+ *   the error.
63
+ *
64
+ * - a direct link to the line(s) of code which generated the error.
65
+ *
66
+ * If you have a customer support team and would like your customers
67
+ * to contact your support team for all problems, instead of using the
68
+ * existing support infrastructure provided by http://ipxe.org, then
69
+ * you may define a custom URI to be included within error messages.
70
+ *
71
+ * Note that the custom URI is a printf() format string which must
72
+ * include a format specifier for the 32-bit error number.
73
+ */
74
+#define PRODUCT_ERROR_URI "http://ipxe.org/%08x"
75
+
31 76
 #include <config/local/branding.h>
32 77
 
33 78
 #endif /* CONFIG_BRANDING_H */

+ 3
- 2
src/hci/strerror.c View File

@@ -2,6 +2,7 @@
2 2
 #include <string.h>
3 3
 #include <stdio.h>
4 4
 #include <ipxe/errortab.h>
5
+#include <config/branding.h>
5 6
 
6 7
 /** @file
7 8
  *
@@ -88,11 +89,11 @@ const char * strerror ( int errno ) {
88 89
 	/* Construct the error message */
89 90
 	if ( errortab ) {
90 91
 		snprintf ( errbuf, sizeof ( errbuf ),
91
-			   "%s (http://ipxe.org/%08x)",
92
+			   "%s (" PRODUCT_ERROR_URI ")",
92 93
 			   errortab->text, errno );
93 94
 	} else {
94 95
 		snprintf ( errbuf, sizeof ( errbuf ),
95
-			   "Error %#08x (http://ipxe.org/%08x)",
96
+			   "Error %#08x (" PRODUCT_ERROR_URI ")",
96 97
 			   errno, errno );
97 98
 	}
98 99
 

Loading…
Cancel
Save