mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Error -> UsageError
This commit is contained in:
parent
8d97030bfd
commit
91d2e8d5ad
1 changed files with 2 additions and 2 deletions
|
@ -212,14 +212,14 @@ void deleteGenerationsOlderThan(const Path & profile, time_t t, bool dryRun)
|
||||||
void deleteGenerationsOlderThan(const Path & profile, const string & timeSpec, bool dryRun)
|
void deleteGenerationsOlderThan(const Path & profile, const string & timeSpec, bool dryRun)
|
||||||
{
|
{
|
||||||
if (timeSpec.empty() || timeSpec[timeSpec.size() - 1] != 'd')
|
if (timeSpec.empty() || timeSpec[timeSpec.size() - 1] != 'd')
|
||||||
throw Error("invalid number of days specifier '%1%', expected something like '14d'", timeSpec);
|
throw UsageError("invalid number of days specifier '%1%', expected something like '14d'", timeSpec);
|
||||||
|
|
||||||
time_t curTime = time(0);
|
time_t curTime = time(0);
|
||||||
string strDays = string(timeSpec, 0, timeSpec.size() - 1);
|
string strDays = string(timeSpec, 0, timeSpec.size() - 1);
|
||||||
auto days = string2Int<int>(strDays);
|
auto days = string2Int<int>(strDays);
|
||||||
|
|
||||||
if (!days || *days < 1)
|
if (!days || *days < 1)
|
||||||
throw Error("invalid number of days specifier '%1%'", timeSpec);
|
throw UsageError("invalid number of days specifier '%1%'", timeSpec);
|
||||||
|
|
||||||
time_t oldTime = curTime - *days * 24 * 3600;
|
time_t oldTime = curTime - *days * 24 * 3600;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue