Changeset 577


Ignore:
Timestamp:
Jul 3, 2006 1:09:20 AM (17 years ago)
Author:
bennylp
Message:

PJLIB will print the exception name when there is an unhandled exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/except.c

    r331 r577  
    2222#include <pj/log.h> 
    2323#include <pj/errno.h> 
     24#include <pj/string.h> 
    2425 
    2526static long thread_local_id = -1; 
     
    4344    handler = pj_thread_local_get(thread_local_id); 
    4445    if (handler == NULL) { 
    45         PJ_LOG(1,("except.c", "!!!FATAL: unhandled exception %d!\n", exception_id)); 
     46        PJ_LOG(1,("except.c", "!!!FATAL: unhandled exception %s!\n",  
     47                   pj_exception_id_name(exception_id))); 
    4648        pj_assert(handler != NULL); 
    4749        /* This will crash the system! */ 
     
    116118PJ_DEF(const char*) pj_exception_id_name(pj_exception_id_t id) 
    117119{ 
     120    static char unknown_name[32]; 
     121 
    118122    /* 
    119123     * Start from 1 (not 0)!!! 
     
    122126    PJ_ASSERT_RETURN(id>0 && id<PJ_MAX_EXCEPTION_ID, "<Invalid ID>"); 
    123127 
    124     if (exception_id_names[id] == NULL) 
    125         return "<Unallocated ID>"; 
     128    if (exception_id_names[id] == NULL) { 
     129        pj_ansi_sprintf(unknown_name, "exception %d", id); 
     130        return unknown_name; 
     131    } 
    126132 
    127133    return exception_id_names[id]; 
Note: See TracChangeset for help on using the changeset viewer.