From bc1e1dc1323dcc3e6eec4cb97bc1d828c9d93546 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kou=C5=99il?= Date: Thu, 2 Jun 2011 13:37:34 +0000 Subject: [PATCH] Added descriptive error messages --- org.glite.px.proxyrenewal/src/common.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/org.glite.px.proxyrenewal/src/common.c b/org.glite.px.proxyrenewal/src/common.c index 70daeb0..4121a10 100644 --- a/org.glite.px.proxyrenewal/src/common.c +++ b/org.glite.px.proxyrenewal/src/common.c @@ -20,6 +20,21 @@ #ident "$Header$" +static const char * const ErrorMsgs[] = { + "Connection closed unexpectedly", + "Generic error", + "Cannot parse protocol messages", + "Obligatory item not found in message", + "Unkown command", + "SSL error", + "MyProxy error", + "Proxy not registered", + "Proxy expired", + "VOMS error", + "Operation timed out", + "System error", +}; + /* nread() and nwrite() never return partial data */ static int nread(int sock, struct timeval *to, char *buf, size_t buf_len, size_t *read_len) @@ -306,7 +321,11 @@ edg_wlpr_CleanResponse(edg_wlpr_Response *response) const char * edg_wlpr_GetErrorString(int code) { - return (code == 0) ? "OK" : "Error"; + if (code == 0) + return "No error"; + if (code <= EDG_WLPR_ERROR_BASE) + return strerror(code); + return ErrorMsgs[code - EDG_WLPR_ERROR_BASE - 1]; } char * -- 1.8.2.3