diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-10 11:59:29 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-10 11:59:29 +0000 |
commit | 33bb24ca6ba1a71f068b79b80b6388aa39d5184d (patch) | |
tree | 6e8ff612cb40552a1f069992fa7f3099653c5b66 | |
parent | d7336f351d9740fc4bfc1289c2b090a0f272d201 (diff) |
Add a default exception handler around main()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4829 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/inspircd.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index aaf20062f..4dc8cf03c 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -961,15 +961,22 @@ int main(int argc, char** argv) try { - ServerInstance = new InspIRCd(argc, argv); - ServerInstance->Run(); - DELETE(ServerInstance); + try + { + ServerInstance = new InspIRCd(argc, argv); + ServerInstance->Run(); + DELETE(ServerInstance); + } + catch (std::bad_alloc) + { + log(SPARSE,"You are out of memory! (got exception std::bad_alloc!)"); + ServerInstance->SendError("**** OUT OF MEMORY **** We're gonna need a bigger boat!"); + } } - catch (std::bad_alloc) + catch (...) { - log(DEFAULT,"You are out of memory! (got exception std::bad_alloc!)"); - ServerInstance->SendError("**** OUT OF MEMORY **** We're gonna need a bigger boat!"); - printf("Out of memory! (got exception std::bad_alloc!"); + log(SPARSE,"Uncaught exception, aborting."); + ServerInstance->SendError("Server terminating due to uncaught exception."); } return 0; } |