mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Code Cleanup
- Constify some catches.
This commit is contained in:
parent
589d8fab5c
commit
7a6cdde571
14 changed files with 19 additions and 19 deletions
|
@ -319,7 +319,7 @@ void TF2::load_tasks ()
|
|||
_loaded_tasks = true;
|
||||
}
|
||||
|
||||
catch (std::string& e)
|
||||
catch (const std::string& e)
|
||||
{
|
||||
throw e + format (STRING_TDB2_PARSE_ERROR, _file._data, line_number);
|
||||
}
|
||||
|
|
|
@ -811,7 +811,7 @@ ARE_THESE_REALLY_HARMFUL:
|
|||
parseTask (task, after, dateformat);
|
||||
}
|
||||
|
||||
catch (std::string& e)
|
||||
catch (const std::string& e)
|
||||
{
|
||||
problem = e;
|
||||
oops = true;
|
||||
|
|
|
@ -97,7 +97,7 @@ int CmdMerge::execute (std::string& output)
|
|||
{
|
||||
context.tdb2.merge (file);
|
||||
}
|
||||
catch (std::string& e) {
|
||||
catch (const std::string& e) {
|
||||
if (e == STRING_TDB2_UP_TO_DATE)
|
||||
{
|
||||
output += e + "\n";
|
||||
|
|
|
@ -111,7 +111,7 @@ int CmdShell::execute (std::string&)
|
|||
context.run ();
|
||||
}
|
||||
|
||||
catch (std::string& error)
|
||||
catch (const std::string& error)
|
||||
{
|
||||
std::cerr << error << "\n";
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ int main (int argc, const char** argv)
|
|||
status = context.run ();
|
||||
}
|
||||
|
||||
catch (std::string& error)
|
||||
catch (const std::string& error)
|
||||
{
|
||||
std::cerr << error << "\n";
|
||||
status = -1;
|
||||
|
|
|
@ -402,7 +402,7 @@ int main (int argc, char** argv)
|
|||
t.is (r26.toString ("YMDHNS"), "20100314235959", "increment across spring DST boundary");
|
||||
}
|
||||
|
||||
catch (std::string& e)
|
||||
catch (const std::string& e)
|
||||
{
|
||||
t.fail ("Exception thrown.");
|
||||
t.diag (e);
|
||||
|
|
|
@ -69,7 +69,7 @@ int main (int argc, char** argv)
|
|||
// TODO dom.set rc.name
|
||||
}
|
||||
|
||||
catch (std::string& error)
|
||||
catch (const std::string& error)
|
||||
{
|
||||
t.diag (error);
|
||||
return -1;
|
||||
|
|
|
@ -58,7 +58,7 @@ int main (int argc, char** argv)
|
|||
t.is (format ("pre {3}{1}{2} post", "one", "two", "three"), "pre threeonetwo post", "format 3b");
|
||||
}
|
||||
|
||||
catch (std::string& error)
|
||||
catch (const std::string& error)
|
||||
{
|
||||
t.diag (error);
|
||||
return -1;
|
||||
|
|
|
@ -175,7 +175,7 @@ int main (int argc, char** argv)
|
|||
t.is (json::decode (encoded), "one\\", "json::decode one\\\\\\\\ -> one\\\\");
|
||||
}
|
||||
|
||||
catch (std::string& e) {t.diag (e);}
|
||||
catch (const std::string& e) {t.diag (e);}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -747,7 +747,7 @@ int main (int argc, char** argv)
|
|||
t.is (n.next (1), "b", " 'bcde' : skip () -> 'b'");
|
||||
}
|
||||
|
||||
catch (std::string& e) {t.diag (e);}
|
||||
catch (const std::string& e) {t.diag (e);}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -42,33 +42,33 @@ int main (int argc, char** argv)
|
|||
Task task;
|
||||
|
||||
try {task = Task ("");}
|
||||
catch (std::string& e){t.diag (e); good = false;}
|
||||
catch (const std::string& e){t.diag (e); good = false;}
|
||||
t.notok (good, "Task::Task ('')");
|
||||
|
||||
// []
|
||||
good = true;
|
||||
try {task = Task ("[]");}
|
||||
catch (std::string& e){t.diag (e); good = false;}
|
||||
catch (const std::string& e){t.diag (e); good = false;}
|
||||
t.notok (good, "Task::Task ('[]')");
|
||||
|
||||
// [name:"value"]
|
||||
good = true;
|
||||
try {task = Task ("[name:\"value\"]");}
|
||||
catch (std::string& e){t.diag (e); good = false;}
|
||||
catch (const std::string& e){t.diag (e); good = false;}
|
||||
t.ok (good, "Task::Task ('[name:\"value\"]')");
|
||||
t.is (task.get ("name"), "value", "name=value");
|
||||
|
||||
// [name:"one two"]
|
||||
good = true;
|
||||
try {task = Task ("[name:\"one two\"]");}
|
||||
catch (std::string& e){t.diag (e); good = false;}
|
||||
catch (const std::string& e){t.diag (e); good = false;}
|
||||
t.ok (good, "Task::Task ('[name:\"one two\"]')");
|
||||
t.is (task.get ("name"), "one two", "name=one two");
|
||||
|
||||
// [one:two three:four]
|
||||
good = true;
|
||||
try {task = Task ("[one:\"two\" three:\"four\"]");}
|
||||
catch (std::string& e){t.diag (e); good = false;}
|
||||
catch (const std::string& e){t.diag (e); good = false;}
|
||||
t.ok (good, "Task::Task ('[one:\"two\" three:\"four\"]')");
|
||||
t.is (task.get ("one"), "two", "one=two");
|
||||
t.is (task.get ("three"), "four", "three=four");
|
||||
|
|
|
@ -75,7 +75,7 @@ int main (int argc, char** argv)
|
|||
good = true;
|
||||
try {
|
||||
empty.getUuid();
|
||||
} catch (std::string& e) { t.diag(e); good = false; }
|
||||
} catch (const std::string& e) { t.diag(e); good = false; }
|
||||
t.notok (good, "Taskmod::getUuid() not");
|
||||
|
||||
// issetAfter() not
|
||||
|
@ -87,7 +87,7 @@ int main (int argc, char** argv)
|
|||
try {
|
||||
std::string uuid = newMod.getUuid();
|
||||
t.is(uuid, "df95dac3-5f2b-af88-5416-03a3163d00fd", "Taskmod::getUuid()");
|
||||
} catch (std::string& e) {
|
||||
} catch (const std::string& e) {
|
||||
t.diag(e);
|
||||
t.fail("Taskmod::getUuid()");
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ int main (int argc, char** argv)
|
|||
// TODO gc
|
||||
}
|
||||
|
||||
catch (std::string& error)
|
||||
catch (const std::string& error)
|
||||
{
|
||||
t.diag (error);
|
||||
return -1;
|
||||
|
|
|
@ -175,7 +175,7 @@ int main (int argc, char** argv)
|
|||
t.ok (string_view.lines () > 4, "View::lines > 4");
|
||||
}
|
||||
|
||||
catch (std::string& e)
|
||||
catch (const std::string& e)
|
||||
{
|
||||
t.fail ("Exception thrown.");
|
||||
t.diag (e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue