mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Fixed: Exceptions during Upgrade and AppStart are reported correctly.
This commit is contained in:
parent
ac568ef47b
commit
7a3f7bf67c
4 changed files with 27 additions and 10 deletions
|
@ -30,8 +30,7 @@ namespace NzbDrone.Common
|
|||
{
|
||||
try
|
||||
{
|
||||
if (RestProvider == null && EnviromentProvider.IsProduction)
|
||||
return;
|
||||
VerifyRestProvider();
|
||||
|
||||
lock (parserErrorCache)
|
||||
{
|
||||
|
@ -59,9 +58,8 @@ namespace NzbDrone.Common
|
|||
{
|
||||
try
|
||||
{
|
||||
if (RestProvider == null && EnviromentProvider.IsProduction)
|
||||
return;
|
||||
|
||||
VerifyRestProvider();
|
||||
|
||||
var report = new ExceptionReport();
|
||||
report.LogMessage = logEvent.FormattedMessage;
|
||||
report.String = logEvent.Exception.ToString();
|
||||
|
@ -81,5 +79,21 @@ namespace NzbDrone.Common
|
|||
logger.Info("Unable to report exception. " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void VerifyRestProvider()
|
||||
{
|
||||
if(RestProvider == null)
|
||||
{
|
||||
if(EnviromentProvider.IsProduction)
|
||||
{
|
||||
logger.Warn("Rest provider wasn't provided. creating new one!");
|
||||
RestProvider = new RestProvider(new EnviromentProvider());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("REST Provider wasn't configured correctly.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue