File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,6 @@ int CmdStop (
7171 {
7272 throw std::string (" No datetime specified." );
7373 }
74- else if (filter.start <= latest.start )
75- {
76- throw std::string (" The end of a date range must be after the start." );
77- }
7874
7975 std::set <std::string> diff = {};
8076
@@ -94,6 +90,23 @@ int CmdStop (
9490 std::inserter (diff, diff.begin ()));
9591 }
9692
93+ if (filter.start <= latest.start )
94+ {
95+ std::stringstream sstr;
96+
97+ sstr << " Interval" ;
98+ auto it = latest.tags ().cbegin ();
99+ auto end = latest.tags ().cend ();
100+ while (it != end)
101+ {
102+ sstr << " " << *it;
103+ ++it;
104+ }
105+ sstr << " started at " << latest.start .toISOLocalExtended ()
106+ << " cannot be stopped at " << filter.start .toISOLocalExtended () << ' .' ;
107+ throw sstr.str ();
108+ }
109+
97110 journal.startTransaction ();
98111
99112 if (diff.empty ())
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ class TestStop(TestCase):
6767
6868 code , out , err = self .t .runError ("stop {:%Y-%m-%dT%H:%M:%S}Z" .format (one_hour_before_utc ))
6969
70- self .assertIn ("The end of a date range must be after the start. " , err )
70+ self .assertIn ("cannot be stopped at " , err )
7171
7272 j = self .t .export ()
7373
You can’t perform that action at this time.
0 commit comments