Interface GateleenExceptionFactory


  • public interface GateleenExceptionFactory
    Applies dependency inversion for exception instantiation. This class did arise because we had different use cases in different applications. One of them has the need to perform fine-grained error reporting. Whereas in the other application this led to performance issues. So now through this abstraction, both applications can choose the behavior they need. There are two default options an app can use (if it does not want to provide a custom impl). One is GateleenThriftyExceptionFactory. It trades maintainability for speed. For example prefers lightweight exceptions without stacktrace recording. Plus it may apply other tricks to reduce resource costs. The other one is GateleenWastefulExceptionFactory. It trades speed for maintainability. So it tries to track as much error details as possible. For example recording stack traces, keeping 'cause' and 'suppressed' exceptions, plus maybe more. If none of those defaults matches, an app can provide its custom implementation via dependency injection.