Write error info to StdErr (#626)
This commit is contained in:
parent
46f6ba1710
commit
ec9854212a
@ -18,11 +18,11 @@ namespace LibationCli
|
|||||||
{
|
{
|
||||||
Environment.ExitCode = (int)ExitCode.RunTimeError;
|
Environment.ExitCode = (int)ExitCode.RunTimeError;
|
||||||
|
|
||||||
Console.WriteLine("ERROR");
|
Console.Error.WriteLine("ERROR");
|
||||||
Console.WriteLine("=====");
|
Console.Error.WriteLine("=====");
|
||||||
Console.WriteLine(ex.Message);
|
Console.Error.WriteLine(ex.Message);
|
||||||
Console.WriteLine();
|
Console.Error.WriteLine();
|
||||||
Console.WriteLine(ex.StackTrace);
|
Console.Error.WriteLine(ex.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ namespace LibationCli
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.Error.WriteLine("CLI error. See log for more details.");
|
||||||
Serilog.Log.Logger.Error(ex, "CLI error");
|
Serilog.Log.Logger.Error(ex, "CLI error");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -54,12 +55,15 @@ namespace LibationCli
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var errorMessage in statusHandler.Errors)
|
foreach (var errorMessage in statusHandler.Errors)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine(errorMessage);
|
||||||
Serilog.Log.Logger.Error(errorMessage);
|
Serilog.Log.Logger.Error(errorMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
var msg = "Error processing book. Skipping. This book will be tried again on next attempt. For options of skipping or marking as error, retry with main Libation app.";
|
var msg = "Error processing book. Skipping. This book will be tried again on next attempt. For options of skipping or marking as error, retry with main Libation app.";
|
||||||
Console.WriteLine(msg + ". See log for more details.");
|
Console.Error.WriteLine(msg + ". See log for more details.");
|
||||||
Serilog.Log.Logger.Error(ex, $"{msg} {{@DebugInfo}}", new { Book = libraryBook.LogFriendly() });
|
Serilog.Log.Logger.Error(ex, $"{msg} {{@DebugInfo}}", new { Book = libraryBook.LogFriendly() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ namespace LibationCli
|
|||||||
|
|
||||||
if (errorsList.Any(e => e.Tag.In(ErrorType.NoVerbSelectedError)))
|
if (errorsList.Any(e => e.Tag.In(ErrorType.NoVerbSelectedError)))
|
||||||
{
|
{
|
||||||
Console.WriteLine("No verb selected");
|
Console.Error.WriteLine("No verb selected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user