Throw InvalidState in DateTime::get_timestamp for out-of-range values
static std::string build_what(const std::string &, int);
};
+/**
+Thrown when "impossible" things happen.
+*/
+class LogicError: public Exception
+{
+public:
+ LogicError(const std::string &w_): Exception(w_) { }
+};
+
template<typename E>
void throw_at(E e, const std::string &a)
{ e.at(a); throw e; }
TimeStamp DateTime::get_timestamp() const
{
if(year<-289701 || year>293641)
- throw Exception("DateTime is not representable as a TimeStamp");
+ throw InvalidState("DateTime is not representable as a TimeStamp");
RawTime raw=(((hour*60LL)+minute)*60+second)*1000000+usec;
int days=(year-1970)*365;