Fixed: Improve logging for invalid NZB messages

pull/181/head
Qstick 7 years ago
parent 586eed0c9d
commit f814b5a6e1

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

@ -24,12 +24,12 @@ namespace NzbDrone.Core.Download
if (nzb == null) 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")) 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; var ns = nzb.Name.Namespace;
@ -37,7 +37,7 @@ namespace NzbDrone.Core.Download
if (files.Empty()) if (files.Empty())
{ {
throw new InvalidNzbException("No files", filename); throw new InvalidNzbException("Invalid NZB: No files [{0}]", filename);
} }
} }
} }

Loading…
Cancel
Save