On Wed, Mar 7, 2012 at 4:31 AM, Steven Schveighoffer <schvei...@yahoo.com> wrote: > On Tue, 06 Mar 2012 22:54:39 -0500, James Miller <ja...@aatch.net> wrote: > >> Surprisingly, I agree with the idea that fatal and critical shouldn't >> throw, or at least shouldn't throw by default, maybe a configuration >> option would allow for that functionality. Logging probably shouldn't >> affect program flow. >> >> Its possible that I may need to log a "critical" error, then do some >> graceful shutdown. > > > I see this pattern emerging: > > try > { > critical("Connection aborted!"); > } > catch(LoggingException e) > { > } > > // do graceful shutdown > ... > > throw SomeError("Connection aborted!"); >
Or you can just: scope(exit) // do graceful shutdown error("connection aborted"); throw SomeError("connection aborted"); Or better yet: scope(exit) // do graceful shutdown //... logAndThrow!(Exception, Severity.error)("connection aborted"); > -Steve