Improved error handling of import process
This commit is contained in:
parent
caaa00f116
commit
ce5f2ae401
@ -47,11 +47,16 @@ internal static class Program
|
||||
{
|
||||
serviceCollection.ImportDataAndAddDatabase(loader.Result.DataFile).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
catch (JsonException)
|
||||
catch (JsonException e)
|
||||
{
|
||||
MessageBox.Show($"The JSON file '{loader.Result.DataFile}' is invalid and cannot be imported.", "Invalid JSON file", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show($"The JSON file '{loader.Result.DataFile}' is invalid and cannot be imported: {e.Message}", "Invalid JSON file", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Environment.Exit(100);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while importing the JSON file '{loader.Result.DataFile}': {e.Message}", "Error while importing JSON file", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Environment.Exit(101);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user