diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-02 18:44:13 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-02 18:44:13 +0000 |
commit | e65b2c70e43882a8b4f31df78b5f9242140320f9 (patch) | |
tree | a6cb1a4c91aec13418e8c0322be3968e71227876 /src/modules | |
parent | 29342eb55763c5a7c4a1749db34d7dcdd69c9ac1 (diff) |
Add error messages to Resolver::OnError()
Add exception handling to several places that use Resolver (it can throw)
Remove Resolver::ProcessResult(), its now handled within the bowels of dns.cpp
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4646 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_cgiirc.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 41 | ||||
-rw-r--r-- | src/modules/m_testcommand.cpp | 4 |
3 files changed, 34 insertions, 13 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 688da6f05..f81b97fed 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -72,7 +72,7 @@ class CGIResolver : public Resolver } } - virtual void OnError(ResolverError e) + virtual void OnError(ResolverError e, const std::string &errormessage) { if ((them) && (them == fd_ref_table[theirfd])) { diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 3a811d1fa..76de8af3a 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -3092,10 +3092,10 @@ class ServernameResolver : public Resolver } } - void OnError(ResolverError e) + void OnError(ResolverError e, const std::string &errormessage) { /* Ooops! */ - WriteOpers("*** CONNECT: Error connecting \002%s\002: Unable to resolve hostname.",MyLink.Name.c_str()); + WriteOpers("*** CONNECT: Error connecting \002%s\002: Unable to resolve hostname - %s",MyLink.Name.c_str(),errormessage.c_str()); } }; @@ -3114,9 +3114,9 @@ class SecurityIPResolver : public Resolver ValidIPs.push_back(result); } - void OnError(ResolverError e) + void OnError(ResolverError e, const std::string &errormessage) { - log(DEBUG,"Could not resolve IP associated with Link '%s'!",MyLink.Name.c_str()); + log(DEBUG,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str()); } }; @@ -3347,8 +3347,15 @@ void ReadConfiguration(bool rebind) insp_inaddr binip; if (insp_aton(L.IPAddr.c_str(), &binip) < 1) { - SecurityIPResolver* sr = new SecurityIPResolver(L.IPAddr, L); - Srv->AddResolver(sr); + try + { + SecurityIPResolver* sr = new SecurityIPResolver(L.IPAddr, L); + Srv->AddResolver(sr); + } + catch (ModuleException& e) + { + log(DEBUG,"Error in resolver: %s",e.GetReason()); + } } LinkBlocks.push_back(L); @@ -3752,8 +3759,15 @@ class ModuleSpanningTree : public Module } else { - ServernameResolver* snr = new ServernameResolver(x->IPAddr, *x); - Srv->AddResolver(snr); + try + { + ServernameResolver* snr = new ServernameResolver(x->IPAddr, *x); + Srv->AddResolver(snr); + } + catch (ModuleException& e) + { + log(DEBUG,"Error in resolver: %s",e.GetReason()); + } } } @@ -3826,8 +3840,15 @@ class ModuleSpanningTree : public Module } else { - ServernameResolver* snr = new ServernameResolver(x->IPAddr, *x); - Srv->AddResolver(snr); + try + { + ServernameResolver* snr = new ServernameResolver(x->IPAddr, *x); + Srv->AddResolver(snr); + } + catch (ModuleException& e) + { + log(DEBUG,"Error in resolver: %s",e.GetReason()); + } } return 1; } diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index 3b27d01d9..fb061a898 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -35,9 +35,9 @@ class MyResolver : public Resolver log(DEBUG,"*** RESOLVER COMPLETED LOOKUP, IP IS: '%s'",result.c_str()); } - virtual void OnError(ResolverError e) + virtual void OnError(ResolverError e, const std::string &errormessage) { - log(DEBUG,"*** RESOLVER GOT ERROR: %d",e); + log(DEBUG,"*** RESOLVER GOT ERROR: %d: %s",e,errormessage.c_str()); } }; |