Skip to content

Commit

Permalink
AmSession: set 'Server Internal Error' on generic exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
furmur committed Nov 1, 2024
1 parent 330bf85 commit 51b9808
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions core/AmSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,24 +402,25 @@ bool AmSession::startup() {
return true;
}

bool AmSession::processEventsCatchExceptions(EventStats *stats) {
try {
try {
processEvents(stats);
}
catch(const AmSession::Exception& e){ throw e; }
catch(const string& str){
DBG("%s",str.c_str());
throw AmSession::Exception(500,"unexpected exception.");
}
catch(...){
throw AmSession::Exception(500,"unexpected exception.");
}
} catch(const AmSession::Exception& e){
DBG("processEventsCatchExceptions(): got exception %i %s",e.code,e.reason.c_str());
return onException(e.code,e.reason);
}
return true;
bool AmSession::processEventsCatchExceptions(EventStats *stats)
{
try {
try {
processEvents(stats);
} catch(const AmSession::Exception& e) {
throw e;
} catch(const string& str) {
DBG("%s", str.c_str());
throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR);
} catch(...) {
throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR);
}
} catch(const AmSession::Exception& e) {
DBG("processEventsCatchExceptions(): got exception %i %s", e.code,e.reason.c_str());
return onException(e.code,e.reason);
}

return true;
}

void AmSession::postEvent(AmEvent* event)
Expand Down

0 comments on commit 51b9808

Please sign in to comment.