Month: June 2014
Exceptions and error logging
At my current work I see an awful lot of code that looks like this:
public class ServiceA : IServiceA { private readonly ILogger _logger; public ServiceA(ILogger logger) { _logger = logger; } public void DoIt() { try { // Do something... } catch(Exception e) { _logger.LogError(e); throw; } } }
At first blush this looks reasonable: it has constructor-based dependency injection, an abstraction, error logging… What could my issue be?