Skip to content

Commit

Permalink
Add Warning Message (#102)
Browse files Browse the repository at this point in the history
Now gives the user an informational warning message if they try to delete a run that doesn't exist
  • Loading branch information
gfs authored Apr 9, 2019
1 parent 6275477 commit fbc1c17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ static void Main(string[] args)
(MonitorCommandOptions opts) => RunMonitorCommand(opts),
(ExportCollectCommandOptions opts) => RunExportCollectCommand(opts),
(ExportMonitorCommandOptions opts) => RunExportMonitorCommand(opts),
(ConfigCommandOptions opts) => SetupConfig(opts),
(ConfigCommandOptions opts) => RunConfigCommand(opts),
errs => 1
);

Log.Information("Attack Surface Analyzer Complete.");
Log.CloseAndFlush();
}

private static int SetupConfig(ConfigCommandOptions opts)
private static int RunConfigCommand(ConfigCommandOptions opts)
{
DatabaseManager.SqliteFilename = opts.DatabaseFilename;

Expand Down Expand Up @@ -982,9 +982,9 @@ public static ERRORS RunGuiMonitorCommand(MonitorCommandOptions opts)
FileSystemMonitor newMon = new FileSystemMonitor(opts.RunId, dir, opts.InterrogateChanges);
monitors.Add(newMon);
}
catch (ArgumentException e)
catch (ArgumentException)
{
Log.Information("{0} is an invalid path.",dir);
Log.Warning("{0} is an invalid path.",dir);
return ERRORS.INVALID_PATH;
}
}
Expand Down
5 changes: 5 additions & 0 deletions Lib/Utils/DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ public static void DeleteRun(string runid)
cmd.Parameters.AddWithValue("@run_id", runid);
using (var reader = cmd.ExecuteReader())
{
if (!reader.HasRows)
{
Log.Warning("That Run ID wasn't found in the database");
return;
}
while (reader.Read())
{
using (var inner_cmd = new SqliteCommand(SQL_TRUNCATE_RUN, DatabaseManager.Connection, DatabaseManager.Transaction))
Expand Down

0 comments on commit fbc1c17

Please sign in to comment.