From 3e3d25f456f58d56499e44289932a9b6bd905488 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Mon, 3 Jul 2006 01:09:20 +0000 Subject: 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 --- pjlib/src/pj/except.c | 12 +++++++++--- 1 file 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 #include #include +#include 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"); - if (exception_id_names[id] == NULL) - return ""; + if (exception_id_names[id] == NULL) { + pj_ansi_sprintf(unknown_name, "exception %d", id); + return unknown_name; + } return exception_id_names[id]; } -- cgit v1.2.3