GeeWee / BetterHostedServices

Fixed a wide variety of issues that have to do with Hosted Services and BackgroundServices, such as error handling and the abillity to access them via the DI.
MIT License
27 stars 4 forks source link

Make CriticalBackgroundService.OnError() abstract #24

Open ProMix0 opened 2 years ago

ProMix0 commented 2 years ago

Describe the feature

Users must handle exceptions differently. If they don't need OnError(), they don't need CriticalBackgroundService.

GeeWee commented 2 years ago

Ah, unfortunately I don't agree with this particular idea. I think logging and failing is a very good default behaviour, and I would be much more worried about someone misunderstanding the API and forget to call _applicationEnder.ShutDownApplication()

ProMix0 commented 2 years ago

Do you mean situation when default

OnError() => throw new NotImplementedException();

will not be catched?

ProMix0 commented 2 years ago

@GeeWee and what? Method should be virtual or abstract?

GeeWee commented 2 years ago

I would leave it exactly as-is, so ´virtual´ with the same default implementation.

ProMix0 commented 2 years ago

Ok, I got it, I'll revert this change in next commit