Improved error message
This commit is contained in:
parent
0d488e8de2
commit
5cc13cb16f
|
@ -1,6 +1,7 @@
|
||||||
#include "TimeRange.h"
|
#include "TimeRange.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <format.h>
|
||||||
|
|
||||||
using time_type = TimeRange::time_type;
|
using time_type = TimeRange::time_type;
|
||||||
|
|
||||||
|
@ -13,7 +14,9 @@ TimeRange::TimeRange(time_type start, time_type end) :
|
||||||
start(start),
|
start(start),
|
||||||
end(end)
|
end(end)
|
||||||
{
|
{
|
||||||
if (start > end) throw std::invalid_argument("Start must not be less than end.");
|
if (start > end) {
|
||||||
|
throw std::invalid_argument(fmt::format("Time range start must not be less than end. Start: {0}, end: {1}", start, end));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
time_type TimeRange::getStart() const {
|
time_type TimeRange::getStart() const {
|
||||||
|
|
Loading…
Reference in New Issue