Error Handling

- Improved some task validation errors by including data.
- Improved the phrasing of some error to be less pompous.
- Marked validation errors that need to be downgraded to warnings.
This commit is contained in:
Paul Beckingham 2011-08-21 12:35:47 -04:00
parent 1b55a48757
commit 9a126ce717
2 changed files with 8 additions and 4 deletions

View file

@ -1091,6 +1091,7 @@ void Task::validate () const
Date due (get_date ("due"));
// Verify wait < due
// TODO Downgrade to warning.
if (has ("wait"))
{
Date wait (get_date ("wait"));
@ -1100,6 +1101,7 @@ void Task::validate () const
Date entry (get_date ("entry"));
// TODO Downgrade to warning.
if (has ("start"))
{
Date start (get_date ("start"));
@ -1107,6 +1109,7 @@ void Task::validate () const
throw std::string (STRING_TASK_VALID_START);
}
// TODO Downgrade to warning.
if (has ("end"))
{
Date end (get_date ("end"));
@ -1128,9 +1131,10 @@ void Task::validate () const
{
Duration d;
if (! d.valid (get ("recur")))
throw std::string (STRING_TASK_VALID_RECUR);
throw std::string (format (STRING_TASK_VALID_RECUR, get ("recur")));
}
// TODO Remove this restriction.
if (has ("wait") &&
getStatus () == Task::recurring)
throw std::string (STRING_TASK_VALID_WAIT_RECUR);