Exemplo n.º 1
0
        public static Task Apply(this OnApiCallError strategy, Exception error, string friendlyMessage = null)
        {
            if (error == null)
            {
                return(Task.CompletedTask);
            }

            Debug.WriteLine(friendlyMessage.WithSuffix(": " + error));

            switch (strategy)
            {
            case OnApiCallError.IgnoreAndNotify:
                // TODO: Log.NotifyByEmail...()
                return(Task.CompletedTask);

            case OnApiCallError.Ignore: return(Task.CompletedTask);

            case OnApiCallError.Throw: return(Task.FromException(error));

            default: throw new NotSupportedException(strategy + " is not implemented.");
            }
        }
Exemplo n.º 2
0
 public static Task Apply(this OnApiCallError strategy, string error) => Apply(strategy, new Exception(error));