WorkManagerSample
WorkManagerSample copied to clipboard
Exception management
Hi I have to perform a task that could go in exception. starting from your example what is the best practice for handling exceptions?
public class CalculatorWorker : Worker
{
public CalculatorWorker(Context context, WorkerParameters workerParameters) : base(context, workerParameters)
{
}
public override Result DoWork()
{
var taxReturn = CalculateTaxes();
Android.Util.Log.Debug("CalculatorWorker", $"Your Tax Return is: {taxReturn}");
return Result.InvokeSuccess();
}
public double CalculateTaxes()
{
throw new Exception("Exception!!!");
return 2000;
}
}