Fixed: Improve logging for invalid NZB messages

Closes #2349
This commit is contained in:
Mark McDowall 2017-12-28 22:05:20 -08:00
parent e8c5e417b6
commit f719c5ccf1
2 changed files with 3 additions and 8 deletions

View File

@ -20,10 +20,5 @@ namespace NzbDrone.Core.Download
public InvalidNzbException(string message, Exception innerException) : base(message, innerException)
{
}
public InvalidNzbException(string message, string nzbName)
: base($"{message} [{0}]", nzbName)
{
}
}
}

View File

@ -24,12 +24,12 @@ namespace NzbDrone.Core.Download
if (nzb == null)
{
throw new InvalidNzbException("No Root element", filename);
throw new InvalidNzbException("Invalid NZB: No Root element [{0}]", filename);
}
if (!nzb.Name.LocalName.Equals("nzb"))
{
throw new InvalidNzbException("Invalid root element", filename);
throw new InvalidNzbException("Invalid NZB: Unexpected root element. Expected 'nzb' found '{0}' [{1}]", nzb.Name.LocalName, filename);
}
var ns = nzb.Name.Namespace;
@ -37,7 +37,7 @@ namespace NzbDrone.Core.Download
if (files.Empty())
{
throw new InvalidNzbException("No files", filename);
throw new InvalidNzbException("Invalid NZB: No files [{0}]", filename);
}
}
}