summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-07-03 01:09:20 +0000
committerBenny Prijono <bennylp@teluu.com>2006-07-03 01:09:20 +0000
commit3e3d25f456f58d56499e44289932a9b6bd905488 (patch)
treeda3cc0a24745bef66f4f380e441979d2f11ca411
parent4de1d93c777da624a6044aa572f3c87842b0b401 (diff)
PJLIB will print the exception name when there is an unhandled exception
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@577 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib/src/pj/except.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/pjlib/src/pj/except.c b/pjlib/src/pj/except.c
index 531573f7..06bdd68f 100644
--- a/pjlib/src/pj/except.c
+++ b/pjlib/src/pj/except.c
@@ -21,6 +21,7 @@
#include <pj/assert.h>
#include <pj/log.h>
#include <pj/errno.h>
+#include <pj/string.h>
static long thread_local_id = -1;
@@ -42,7 +43,8 @@ PJ_DEF(void) pj_throw_exception_(int exception_id)
handler = pj_thread_local_get(thread_local_id);
if (handler == NULL) {
- PJ_LOG(1,("except.c", "!!!FATAL: unhandled exception %d!\n", exception_id));
+ PJ_LOG(1,("except.c", "!!!FATAL: unhandled exception %s!\n",
+ pj_exception_id_name(exception_id)));
pj_assert(handler != NULL);
/* This will crash the system! */
}
@@ -115,14 +117,18 @@ PJ_DEF(pj_status_t) pj_exception_id_free( pj_exception_id_t id )
PJ_DEF(const char*) pj_exception_id_name(pj_exception_id_t id)
{
+ static char unknown_name[32];
+
/*
* Start from 1 (not 0)!!!
* Exception 0 is reserved for normal path of setjmp()!!!
*/
PJ_ASSERT_RETURN(id>0 && id<PJ_MAX_EXCEPTION_ID, "<Invalid ID>");
- if (exception_id_names[id] == NULL)
- return "<Unallocated ID>";
+ if (exception_id_names[id] == NULL) {
+ pj_ansi_sprintf(unknown_name, "exception %d", id);
+ return unknown_name;
+ }
return exception_id_names[id];
}