summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/treesocket1.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-04-16 13:08:44 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-04-16 13:08:44 +0200
commit3eb205218a321e454d873ae14e2e717ce9d64142 (patch)
tree4f0c4aabf7fe7c51b329e09b59984977869fd786 /src/modules/m_spanningtree/treesocket1.cpp
parent89abc5d517154c8a6bb62b876593b03d51e8edc7 (diff)
m_spanningtree Throw an exception on protocol violations instead of returning CMD_INVALID
Catch CoreExceptions, log and close the link in OnDataReady()
Diffstat (limited to 'src/modules/m_spanningtree/treesocket1.cpp')
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 9da06e829..931bd3f9f 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -251,7 +251,18 @@ void TreeSocket::OnDataReady()
SendError("Read null character from socket");
break;
}
- ProcessLine(line);
+
+ try
+ {
+ ProcessLine(line);
+ }
+ catch (CoreException& ex)
+ {
+ ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error while processing: " + line);
+ ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, ex.GetReason());
+ SendError(ex.GetReason() + " - check the log file for details");
+ }
+
if (!getError().empty())
break;
}