summaryrefslogtreecommitdiff
path: root/src/helperfuncs.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-19 14:44:32 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-19 14:44:32 +0000
commit2a9b0cdd30113ab4926f4b68350d619c015c89a3 (patch)
treec756e270ca7d938d62d09c2ecee9d7c6be34af50 /src/helperfuncs.cpp
parent45fa01dc79889c68734a7629e8487917cf26a836 (diff)
Added exception handling for module loading
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3240 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r--src/helperfuncs.cpp64
1 files changed, 57 insertions, 7 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index fc4ec970f..0255de227 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -135,7 +135,14 @@ void Write_NoFormat(int sock, const char *text)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
- Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ try
+ {
+ Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ }
+ catch (ModuleException modexcept)
+ {
+ log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \
+ }
}
else
{
@@ -166,7 +173,14 @@ void Write(int sock,char *text, ...)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
- Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ try
+ {
+ Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ }
+ catch (ModuleException modexcept)
+ {
+ log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \
+ }
}
else
{
@@ -188,7 +202,14 @@ void WriteServ_NoFormat(int sock, const char* text)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
- Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ try
+ {
+ Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ }
+ catch (ModuleException modexcept)
+ {
+ log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \
+ }
}
else
{
@@ -221,7 +242,14 @@ void WriteServ(int sock, char* text, ...)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
- Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ try
+ {
+ Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ }
+ catch (ModuleException modexcept)
+ {
+ log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \
+ }
}
else
{
@@ -243,7 +271,14 @@ void WriteFrom_NoFormat(int sock, userrec *user, const char* text)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
- Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ try
+ {
+ Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ }
+ catch (ModuleException modexcept)
+ {
+ log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \
+ }
}
else
{
@@ -276,7 +311,14 @@ void WriteFrom(int sock, userrec *user,char* text, ...)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
- Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ try
+ {
+ Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
+ }
+ catch (ModuleException modexcept)
+ {
+ log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \
+ }
}
else
{
@@ -1340,7 +1382,15 @@ void ShowMOTD(userrec *user)
// only one write operation
if (Config->GetIOHook(user->port))
{
- Config->GetIOHook(user->port)->OnRawSocketWrite(user->fd,(char*)WholeMOTD.c_str(),WholeMOTD.length());
+ try
+ {
+ Config->GetIOHook(user->port)->OnRawSocketWrite(user->fd,(char*)WholeMOTD.c_str(),WholeMOTD.length());
+ }
+ catch (ModuleException modexcept)
+ {
+ log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \
+ }
+
}
else
{