diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-16 21:40:06 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-16 21:40:06 +0000 |
commit | dbe93e44775c4a274d329e152babd8330dadcbf8 (patch) | |
tree | 55d4bd231ecbe94f563e15e45c725acc860d4447 /src | |
parent | d2bc82e04d45bcafabc430e765fdfc8eb43d558e (diff) |
Add stuff so that the core catches CoreException properly
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6017 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 4 | ||||
-rw-r--r-- | src/inspsocket.cpp | 21 | ||||
-rw-r--r-- | src/socket.cpp | 4 | ||||
-rw-r--r-- | src/userprocess.cpp | 4 | ||||
-rw-r--r-- | src/users.cpp | 12 |
5 files changed, 22 insertions, 23 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 59be29843..54c3aa0ab 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -653,10 +653,10 @@ bool InspIRCd::LoadModule(const char* filename) return false; } } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { this->Log(DEFAULT,"Unable to load %s: ",modfile,modexcept.GetReason()); - snprintf(MODERR,MAXBUF,"Factory function threw an exception: %s",modexcept.GetReason()); + snprintf(MODERR,MAXBUF,"Factory function of %s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); return false; } } diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 34f4a6201..68e2c8f96 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -262,9 +262,9 @@ void InspSocket::Close() { Instance->Config->GetIOHook(this)->OnRawSocketClose(this->fd); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); + Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } this->OnClose(); @@ -293,9 +293,9 @@ char* InspSocket::Read() { MOD_RESULT = Instance->Config->GetIOHook(this)->OnRawSocketRead(this->fd,this->ibuf,sizeof(this->ibuf),result2); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason()); + Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } if (MOD_RESULT < 0) { @@ -397,9 +397,9 @@ bool InspSocket::FlushWriteBuffer() return true; } } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason()); + Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); return true; } } @@ -517,9 +517,9 @@ bool InspSocket::Poll() { Instance->Config->GetIOHook(this)->OnRawSocketConnect(this->fd); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); + Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } return this->OnConnected(); @@ -544,9 +544,9 @@ bool InspSocket::Poll() Instance->Config->GetIOHook(this)->OnRawSocketAccept(incoming, insp_ntoa(client.sin_addr), this->port); #endif } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); + Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } @@ -637,7 +637,6 @@ void InspSocket::HandleEvent(EventType et, int errornum) } else { - Instance->Log(DEBUG,"State=%d CONNECTED=%d", this->state, I_CONNECTED); if (this->FlushWriteBuffer()) { this->Instance->SE->DelFd(this); diff --git a/src/socket.cpp b/src/socket.cpp index 6883e05fd..b286ee96f 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -80,9 +80,9 @@ void ListenSocket::HandleEvent(EventType et, int errornum) ServerInstance->Config->GetIOHook(in_port)->OnRawSocketAccept(incomingSockfd, insp_ntoa(client.sin_addr), in_port); #endif } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - ServerInstance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); + ServerInstance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } ServerInstance->stats->statsAccept++; diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 1e21c065d..a740d0d7c 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -37,9 +37,9 @@ void InspIRCd::ProcessUser(userrec* cu) { MOD_RESULT = this->Config->GetIOHook(cu->GetPort())->OnRawSocketRead(cu->GetFd(),ReadBuffer,sizeof(ReadBuffer),result2); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - this->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason()); + this->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } if (MOD_RESULT < 0) diff --git a/src/users.cpp b/src/users.cpp index 1abbcc37a..4a77b450f 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -153,7 +153,7 @@ void userrec::StartDNSLookup() res_reverse = new UserResolver(this->ServerInstance, this, this->GetIPString(), DNS_QUERY_REVERSE); this->ServerInstance->AddResolver(res_reverse); } - catch (ModuleException& e) + catch (CoreException& e) { ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason()); } @@ -186,7 +186,7 @@ void UserResolver::OnLookupComplete(const std::string &result) this->ServerInstance->AddResolver(bound_user->res_forward); } } - catch (ModuleException& e) + catch (CoreException& e) { ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason()); } @@ -791,9 +791,9 @@ void userrec::QuitUser(InspIRCd* Instance, userrec *user, const std::string &qui { Instance->Config->GetIOHook(user->GetPort())->OnRawSocketClose(user->fd); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); + Instance->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } @@ -1445,9 +1445,9 @@ void userrec::Write(std::string text) { ServerInstance->Config->GetIOHook(this->GetPort())->OnRawSocketWrite(this->fd, text.data(), text.length()); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - ServerInstance->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason()); + ServerInstance->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } else |