diff options
Diffstat (limited to 'project2/variables.cpp')
-rw-r--r-- | project2/variables.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/project2/variables.cpp b/project2/variables.cpp index 29e6353..5514638 100644 --- a/project2/variables.cpp +++ b/project2/variables.cpp @@ -12,9 +12,9 @@ #include <boost/bind.hpp> #include <boost/date_time/posix_time/posix_time.hpp> -class UnknownVariableType : public std::exception { }; -class UnknownVariableSource : public std::exception { }; -class NoVariableDefinition : public std::exception { }; +SimpleMessageException(UnknownVariableType); +SimpleMessageException(UnknownVariableSource); +SimpleMessageException(NoVariableDefinition); enum VT_typeID { DefaultType, @@ -49,13 +49,14 @@ getVariableTypeFromName(const std::string & src) if (src == "double") return Double; if (src == "datetime") return DateTime; if (src == "datetimeptr") return DateTimePtr; - throw UnknownVariableType(); + throw UnknownVariableType(src); } static VariableType makeVariableType(const Glib::ustring & src, const VT_typeID format = DefaultType) { switch (format) { + default: case DefaultType: case StringPtr: return boost::shared_ptr<Glib::ustring>(new Glib::ustring(src)); @@ -82,7 +83,6 @@ makeVariableType(const Glib::ustring & src, const VT_typeID format = DefaultType case DateTimePtr: return boost::shared_ptr<boost::posix_time::ptime>(new boost::posix_time::ptime(boost::posix_time::time_from_string(src))); } - throw UnknownVariableType(); } VariableType::VariableType() : @@ -268,7 +268,7 @@ class VariableParent : public VariableImplDyn, public RowUser { RowSet::RowValuesStack::const_reverse_iterator r = RowSet::Stack().rbegin(); for (size_t p = depth; p--; r++) ; if (r == RowSet::Stack().rend()) { - throw RowSet::ParentOutOfRange(); + throw RowSet::ParentOutOfRange(depth); } row = *r; row->use(this); @@ -377,7 +377,7 @@ Variable::Variable(const xmlpp::Element * e, const Glib::ustring & n, bool requi else if (source == "literal" || source.empty()) var = new VariableLiteral(c->get_attribute_value("value"), getVariableTypeFromName(c->get_attribute_value("type"))); else - throw UnknownVariableSource(); + throw UnknownVariableSource(source); return; } } @@ -385,7 +385,7 @@ Variable::Variable(const xmlpp::Element * e, const Glib::ustring & n, bool requi var = new VariableFixed(def); return; } - throw NoVariableDefinition(); + throw NoVariableDefinition(n); } Variable::Variable(VariableImpl * v) : |