diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/services.h | 14 |
1 files changed, 11 insertions, 3 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 { |
