From e65b2c70e43882a8b4f31df78b5f9242140320f9 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 2 Aug 2006 18:44:13 +0000 Subject: 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 --- src/modules/m_spanningtree.cpp | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'src/modules/m_spanningtree.cpp') 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; } -- cgit v1.3.1-10-gc9f91