I’m doing a Fire-and-Forget method invocation like this.
BackgroundJob.Enqueue(() => SendEmail(name));
I want to fail the job inside the SendEmail() method.
Because since all the probable exceptions are handled in my code, even if an exception occurs in the job method, the result of the job will be ‘Successful’. Because the exception is handled.
How to force to Fail a Job?. According to the above topic we have to throw an exception in order to fail a job. Is there any other way to do this?