summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/services.h14
-rw-r--r--modules/protocol/unreal32.cpp2
-rw-r--r--src/misc.cpp2
3 files changed, 13 insertions, 5 deletions
diff --git a/include/services.h b/include/services.h
index 5448d9170..d233da5b8 100644
--- a/include/services.h
+++ b/include/services.h
@@ -357,12 +357,20 @@ template<typename T, size_t Size = 32> class Flags
/*************************************************************************/
+class ConvertException : public CoreException
+{
+ public:
+ ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
+
+ virtual ~ConvertException() throw() { }
+};
+
template<typename T> inline Anope::string stringify(const T &x)
{
std::ostringstream stream;
if (!(stream << x))
- throw CoreException("Stringify fail");
+ throw ConvertException("Stringify fail");
return stream.str();
}
@@ -374,11 +382,11 @@ template<typename T> inline void convert(const Anope::string &s, T &x, Anope::st
char c;
bool res = i >> x;
if (!res)
- throw CoreException("Convert fail");
+ throw ConvertException("Convert fail");
if (failIfLeftoverChars)
{
if (i.get(c))
- throw CoreException("Convert fail");
+ throw ConvertException("Convert fail");
}
else
{
diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal32.cpp
index 4c0d79ee2..2993580c7 100644
--- a/modules/protocol/unreal32.cpp
+++ b/modules/protocol/unreal32.cpp
@@ -977,7 +977,7 @@ bool ChannelModeFlood::IsValid(const Anope::string &value) const
if (value[0] != ':' && convertTo<unsigned>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<unsigned>(rest.substr(1), rest, false) > 0 && rest.empty())
return true;
}
- catch (const CoreException &) { } // convertTo fail
+ catch (const ConvertException &) { }
/* '['<number><1 letter>[optional: '#'+1 letter],[next..]']'':'<number> */
size_t end_bracket = value.find(']', 1);
diff --git a/src/misc.cpp b/src/misc.cpp
index 97006469a..a8b1d5ca6 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -228,7 +228,7 @@ time_t dotime(const Anope::string &s)
}
}
}
- catch (const CoreException &) { }
+ catch (const ConvertException &) { }
return 0;
}