2014-10-03 17:50:43 +00:00
|
|
|
using System;
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
|
|
|
|
namespace NzbDrone.Common.Exceptron
|
|
|
|
{
|
|
|
|
public static class ExceptionExtentions
|
|
|
|
{
|
|
|
|
private const string IGNORE_FLAG = "exceptron_ignore";
|
|
|
|
|
|
|
|
public static Exception ExceptronIgnoreOnMono(this Exception exception)
|
|
|
|
{
|
2014-12-07 20:54:07 +00:00
|
|
|
if (OsInfo.IsNotWindows)
|
2014-10-03 17:50:43 +00:00
|
|
|
{
|
|
|
|
exception.ExceptronIgnore();
|
|
|
|
}
|
|
|
|
|
|
|
|
return exception;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Exception ExceptronIgnore(this Exception exception)
|
|
|
|
{
|
|
|
|
exception.Data.Add(IGNORE_FLAG, true);
|
|
|
|
return exception;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool ExceptronShouldIgnore(this Exception exception)
|
|
|
|
{
|
|
|
|
return exception.Data.Contains(IGNORE_FLAG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|