summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-25 21:02:00 -0400
committermidipix <writeonce@midipix.org>2016-11-11 00:22:51 -0500
commitf72b5d8dd5779375a7c32f5148f67f69700984b9 (patch)
treea0076ae64abecbe18db138b3e9f1a7d8c52d3748 /src
parentf2737f6303b86bcdde64648bb08f0bd434f878cf (diff)
downloadmdso-f72b5d8dd5779375a7c32f5148f67f69700984b9.tar.bz2
mdso-f72b5d8dd5779375a7c32f5148f67f69700984b9.tar.xz
mdso_output_error(): added descriptive custom error strings.
Diffstat (limited to 'src')
-rw-r--r--src/output/mdso_output_error.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/output/mdso_output_error.c b/src/output/mdso_output_error.c
index 59469b9..243a64e 100644
--- a/src/output/mdso_output_error.c
+++ b/src/output/mdso_output_error.c
@@ -17,6 +17,16 @@ static const char aclr_green[] = "\x1b[32m";
static const char aclr_blue[] = "\x1b[34m";
static const char aclr_magenta[] = "\x1b[35m";
+static const char const * const mdso_error_strings[MDSO_ERR_CAP] = {
+ [MDSO_ERR_FLOW_ERROR] = "flow error: unexpected condition or other",
+ [MDSO_ERR_FLEE_ERROR] = "flees and bugs and cats and mice",
+ [MDSO_ERR_NULL_CONTEXT] = "null driver or unit context",
+ [MDSO_ERR_NULL_SOURCE] = "source file does not define any symbols",
+ [MDSO_ERR_INVALID_CONTEXT] = "invalid driver or unit context",
+ [MDSO_ERR_INVALID_SOURCE] = "invalid symbol definition source file",
+ [MDSO_ERR_SOURCE_SIZE_ZERO] = "cannot map an empty symbol definition source file",
+};
+
static const char * mdso_output_error_header(const struct mdso_error_info * erri)
{
if (erri->eflags & MDSO_ERROR_CHILD)
@@ -35,7 +45,9 @@ static const char * mdso_output_error_header(const struct mdso_error_info * erri
static const char * mdso_output_strerror(const struct mdso_error_info * erri)
{
if (erri->eflags & MDSO_ERROR_CUSTOM)
- return "flow error: unexpected condition or other";
+ return ((erri->elibcode < 0) || (erri->elibcode >= MDSO_ERR_CAP))
+ ? "internal error: please report to the maintainer"
+ : mdso_error_strings[erri->elibcode];
else if (erri->eflags & MDSO_ERROR_NESTED)
return "";