diff options
author | Attila Molnar <attilamolnar@hush.com> | 2013-12-18 16:20:40 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2013-12-18 16:20:40 +0100 |
commit | 1e8389b27ff99ad9f48c890486ebef936acafc41 (patch) | |
tree | 44543c79a89509604d2fa7b910c278476b9a0eba /src | |
parent | 0680b529874b701b20650586d8466a155d9ba0d5 (diff) |
Clean up CoreException
- Remove default constructor
- Replace virtual functions returning C strings with functions returning const std::string refs
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/cmd_dns.cpp | 2 | ||||
-rw-r--r-- | src/commands/cmd_hostname_lookup.cpp | 4 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 4 | ||||
-rw-r--r-- | src/inspsocket.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_customprefix.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_dnsbl.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_ident.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_rline.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/addline.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/usermanager.cpp | 2 |
13 files changed, 20 insertions, 20 deletions
diff --git a/src/commands/cmd_dns.cpp b/src/commands/cmd_dns.cpp index f9ec8e990..07ade381a 100644 --- a/src/commands/cmd_dns.cpp +++ b/src/commands/cmd_dns.cpp @@ -580,7 +580,7 @@ class MyManager : public Manager, public Timer, public EventHandler } catch (Exception& ex) { - ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG, std::string(ex.GetReason())); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, ex.GetReason()); return; } diff --git a/src/commands/cmd_hostname_lookup.cpp b/src/commands/cmd_hostname_lookup.cpp index 3287f3662..c26d3b3d3 100644 --- a/src/commands/cmd_hostname_lookup.cpp +++ b/src/commands/cmd_hostname_lookup.cpp @@ -92,7 +92,7 @@ class UserResolver : public DNS::Request catch (DNS::Exception& e) { delete res_forward; - ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG, "Error in resolver: %s",e.GetReason()); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Error in resolver: " + e.GetReason()); bound_user->WriteNotice("*** There was an internal error resolving your host, using your IP address (" + bound_user->GetIPString() + ") instead."); dl->set(bound_user, 0); @@ -214,7 +214,7 @@ class ModuleHostnameLookup : public Module { this->dnsLookup.set(user, 0); delete res_reverse; - ServerInstance->Logs->Log("USERS", LOG_DEBUG, "Error in resolver: %s", e.GetReason()); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Error in resolver: " + e.GetReason()); ServerInstance->stats->statsDnsBad++; } } diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 1899ce1b3..354d0a112 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -404,13 +404,13 @@ const char* InspIRCd::Format(va_list &vaList, const char* formatString) if (vsnret > 0 && static_cast<unsigned>(vsnret) < formatBuffer.size()) { - return &formatBuffer[0]; + break; } formatBuffer.resize(formatBuffer.size() * 2); } - throw CoreException(); + return &formatBuffer[0]; } const char* InspIRCd::Format(const char* formatString, ...) diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index d7a25785d..8822f69f8 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -132,7 +132,7 @@ void StreamSocket::Close() catch (CoreException& modexcept) { ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "%s threw an exception: %s", - modexcept.GetSource(), modexcept.GetReason()); + modexcept.GetSource().c_str(), modexcept.GetReason().c_str()); } DelIOHook(); } @@ -172,7 +172,7 @@ void StreamSocket::DoRead() catch (CoreException& modexcept) { ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "%s threw an exception: %s", - modexcept.GetSource(), modexcept.GetReason()); + modexcept.GetSource().c_str(), modexcept.GetReason().c_str()); return; } if (rv > 0) @@ -321,7 +321,7 @@ void StreamSocket::DoWrite() catch (CoreException& modexcept) { ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "%s threw an exception: %s", - modexcept.GetSource(), modexcept.GetReason()); + modexcept.GetSource().c_str(), modexcept.GetReason().c_str()); } } #ifndef DISABLE_WRITEV @@ -533,7 +533,7 @@ void StreamSocket::HandleEvent(EventType et, int errornum) catch (CoreException& ex) { ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "Caught exception in socket processing on FD %d - '%s'", - fd, ex.GetReason()); + fd, ex.GetReason().c_str()); SetError(ex.GetReason()); } if (!error.empty()) diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 9e67a4f08..5dea028fb 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -222,7 +222,7 @@ class ModuleCgiIRC : public Module waiting.set(user, count - 1); delete r; if (cmd.notify) - ServerInstance->SNO->WriteToSnoMask('a', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname; %s", user->nick.c_str(), user->host.c_str(), ex.GetReason()); + ServerInstance->SNO->WriteToSnoMask('a', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname; %s", user->nick.c_str(), user->host.c_str(), ex.GetReason().c_str()); } } diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp index f0b6d88e3..107c6d684 100644 --- a/src/modules/m_customprefix.cpp +++ b/src/modules/m_customprefix.cpp @@ -69,7 +69,7 @@ class ModuleCustomPrefix : public Module } catch (ModuleException& e) { - throw ModuleException(e.err + " (while creating mode from " + tag->getTagLocation() + ")"); + throw ModuleException(e.GetReason() + " (while creating mode from " + tag->getTagLocation() + ")"); } } } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 48ce1d791..10419de51 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -346,7 +346,7 @@ class ModuleDNSBL : public Module catch (DNS::Exception &ex) { delete r; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, std::string(ex.GetReason())); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, ex.GetReason()); } if (user->quitting) diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 329dd10ff..25aa2f97a 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -551,7 +551,7 @@ void ModuleFilter::OnDecodeMetaData(Extensible* target, const std::string &extna } catch (ModuleException& e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Error when unserializing filter: " + std::string(e.GetReason())); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Error when unserializing filter: " + e.GetReason()); } } } @@ -619,7 +619,7 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string &freeform } catch (ModuleException &e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason()); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason().c_str()); return std::make_pair(false, e.GetReason()); } return std::make_pair(true, ""); @@ -683,7 +683,7 @@ void ModuleFilter::ReadFilters() } catch (ModuleException &e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason()); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason().c_str()); } } } diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 516287668..c73e26b16 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -303,7 +303,7 @@ class ModuleIdent : public Module } catch (ModuleException &e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Ident exception: %s", e.GetReason()); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Ident exception: " + e.GetReason()); } } diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 35f88ea93..2aee89ad2 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -154,7 +154,7 @@ class CommandRLine : public Command } catch (ModuleException &e) { - ServerInstance->SNO->WriteToSnoMask('a',"Could not add RLINE: %s", e.GetReason()); + ServerInstance->SNO->WriteToSnoMask('a',"Could not add RLINE: " + e.GetReason()); } if (r) diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index f4485030a..c6ca17db0 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -42,7 +42,7 @@ CmdResult CommandAddLine::Handle(User* usr, std::vector<std::string>& params) } catch (ModuleException &e) { - ServerInstance->SNO->WriteToSnoMask('d',"Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason()); + ServerInstance->SNO->WriteToSnoMask('d',"Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason().c_str()); return CMD_FAILURE; } xl->SetCreateTime(ConvToInt(params[3])); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 75b75f8c0..017f1c522 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -280,7 +280,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) catch (DNS::Exception& e) { delete snr; - ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",x->Name.c_str(), e.GetReason()); + ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",x->Name.c_str(), e.GetReason().c_str()); ConnectServer(y, false); } } diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 191760686..1d1a05fa2 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -73,7 +73,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs } catch (CoreException& modexcept) { - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "%s threw an exception: %s", modexcept.GetSource().c_str(), modexcept.GetReason().c_str()); } } |