diff --git a/src/Umbraco.Core/Attempt{T}.cs b/src/Umbraco.Core/Attempt{T}.cs index a5dce955c7..c1f88cab20 100644 --- a/src/Umbraco.Core/Attempt{T}.cs +++ b/src/Umbraco.Core/Attempt{T}.cs @@ -27,6 +27,13 @@ namespace Umbraco.Core /// public Exception Exception { get { return _exception; } } + /// + /// Gets the exception associated with an unsuccessful attempt. + /// + /// Keep it for backward compatibility sake. + [Obsolete(".Error is obsolete, you should use .Exception instead.", false)] + public Exception Error { get { return _exception; } } + /// /// Gets the attempt result. /// @@ -38,6 +45,13 @@ namespace Umbraco.Core // optimize, use a singleton failed attempt private static readonly Attempt Failed = new Attempt(false, default(T), null); + /// + /// Represents an unsuccessful attempt. + /// + /// Keep it for backward compatibility sake. + [Obsolete(".Failed is obsolete, you should use Attempt.Fail() instead.", false)] + public static readonly Attempt False = Failed; + // private - use Succ() or Fail() methods to create attempts private Attempt(bool success, T result, Exception exception) { @@ -46,6 +60,27 @@ namespace Umbraco.Core _exception = exception; } + /// + /// Initialize a new instance of the struct with a result. + /// + /// A value indicating whether the attempt is successful. + /// The result of the attempt. + /// Keep it for backward compatibility sake. + [Obsolete("Attempt ctors are obsolete, you should use Attempt.Succ(), Attempt.Fail() or Attempt.If() instead.", false)] + public Attempt(bool success, T result) + : this(success, result, null) + { } + + /// + /// Initialize a new instance of the struct representing a failed attempt, with an exception. + /// + /// The exception causing the failure of the attempt. + /// Keep it for backward compatibility sake. + [Obsolete("Attempt ctors are obsolete, you should use Attempt.Succ(), Attempt.Fail() or Attempt.If() instead.", false)] + public Attempt(Exception exception) + : this(false, default(T), exception) + { } + /// /// Creates a successful attempt. ///