mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
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:
parent
1b55a48757
commit
9a126ce717
2 changed files with 8 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -422,9 +422,9 @@
|
|||
#define STRING_TASK_VALID_WAIT "A 'wait' date must be before a 'due' date."
|
||||
#define STRING_TASK_VALID_START "A 'start' date must be after an 'entry' date."
|
||||
#define STRING_TASK_VALID_END "An 'end' date must be after an 'entry' date."
|
||||
#define STRING_TASK_VALID_REC_DUE "You cannot specify a recurring task without a due date."
|
||||
#define STRING_TASK_VALID_UNTIL "You cannot specify an until date for a non-recurring task."
|
||||
#define STRING_TASK_VALID_RECUR "A recurrence value must be valid."
|
||||
#define STRING_TASK_VALID_REC_DUE "A recurring task must also have a 'due' date."
|
||||
#define STRING_TASK_VALID_UNTIL "Only recurring tasks may have an 'until' date."
|
||||
#define STRING_TASK_VALID_RECUR "The recurrence value '{1}' is not valid."
|
||||
#define STRING_TASK_VALID_WAIT_RECUR "You cannot create a task that is both waiting and recurring."
|
||||
#define STRING_TASK_VALID_PRIORITY "Priority values may be 'H', 'M' or 'L', not '{1}'."
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue