diff options
author | Michael Brown | 2015-02-11 14:32:57 +0100 |
---|---|---|
committer | Michael Brown | 2015-02-11 15:11:28 +0100 |
commit | eac445b650d60b54bae2e6738ef45117adacd90a (patch) | |
tree | 28b84b8b6556f48e6f4ea9d83751dae316754ab1 | |
parent | [build] Allow product URI to be customised via config/branding.h (diff) | |
download | ipxe-eac445b650d60b54bae2e6738ef45117adacd90a.tar.gz ipxe-eac445b650d60b54bae2e6738ef45117adacd90a.tar.xz ipxe-eac445b650d60b54bae2e6738ef45117adacd90a.zip |
[build] Allow error message URI to be customised via config/branding.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/config/branding.h | 45 | ||||
-rw-r--r-- | src/hci/strerror.c | 5 |
2 files changed, 48 insertions, 2 deletions
diff --git a/src/config/branding.h b/src/config/branding.h index abb32612..4bd7e3cc 100644 --- a/src/config/branding.h +++ b/src/config/branding.h @@ -28,6 +28,51 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define PRODUCT_SHORT_NAME "iPXE" #define PRODUCT_URI "http://ipxe.org" +/* + * Error messages + * + * iPXE error messages comprise a summary error message + * (e.g. "Permission denied") and a 32-bit error number. This number + * is incorporated into an error URI such as + * + * "No such file or directory (http://ipxe.org/2d0c613b)" + * + * or + * + * "Operation not supported (http://ipxe.org/3c092003)" + * + * Users may browse to the URI within the error message, which is + * provided by a database running on the iPXE web site + * (http://ipxe.org). This database provides details for all possible + * errors generated by iPXE, including: + * + * - the detailed error message (e.g. "Not an OCSP signing + * certificate") to complement the summary message (e.g. "Permission + * denied") which is compiled into the iPXE binary. + * + * - an instruction to the user to upgrade, if the error cannot be + * generated by the latest version of iPXE. + * + * - hints on how to fix the error (e.g. "This error indicates that + * the file was not found on the TFTP server. Check that you can + * retrieve the file using an alternative TFTP client, such as + * tftp-hpa on Linux.") + * + * - details of which source file within the iPXE codebase generated + * the error. + * + * - a direct link to the line(s) of code which generated the error. + * + * If you have a customer support team and would like your customers + * to contact your support team for all problems, instead of using the + * existing support infrastructure provided by http://ipxe.org, then + * you may define a custom URI to be included within error messages. + * + * Note that the custom URI is a printf() format string which must + * include a format specifier for the 32-bit error number. + */ +#define PRODUCT_ERROR_URI "http://ipxe.org/%08x" + #include <config/local/branding.h> #endif /* CONFIG_BRANDING_H */ diff --git a/src/hci/strerror.c b/src/hci/strerror.c index 9356e9e0..4e97d957 100644 --- a/src/hci/strerror.c +++ b/src/hci/strerror.c @@ -2,6 +2,7 @@ #include <string.h> #include <stdio.h> #include <ipxe/errortab.h> +#include <config/branding.h> /** @file * @@ -88,11 +89,11 @@ const char * strerror ( int errno ) { /* Construct the error message */ if ( errortab ) { snprintf ( errbuf, sizeof ( errbuf ), - "%s (http://ipxe.org/%08x)", + "%s (" PRODUCT_ERROR_URI ")", errortab->text, errno ); } else { snprintf ( errbuf, sizeof ( errbuf ), - "Error %#08x (http://ipxe.org/%08x)", + "Error %#08x (" PRODUCT_ERROR_URI ")", errno, errno ); } |