On 4 August 2014 12:04, Mike Parker via Digitalmars-d < [email protected]> wrote:
> On 8/4/2014 12:28 AM, Manu via Digitalmars-d wrote: > >> I'm trying to make better use of scope guards, but I find myself belting >> out try/catch statements almost everywhere. >> I'm rather disappointed, because scope guards are advertised to offer >> the promise of eliminating try/catch junk throughout your code, and I'm >> just not finding that to be the practical reality. >> >> I think the core of the problem is that scope(failure) is >> indiscriminate, but I want to filter it for particular exceptions. The >> other issue is that you still need a catch() if you don't actually want >> the program to terminate, which implies a try... :/ >> > > Scope guards are for when you don't need to handle exceptions. If you need > the exceptions, use try...catch. I don't think it would be a good idea to > have two different means of handling exceptions. > Well, then they're not particularly useful in practise. I'm finding that I can rarely blanket an operation across all exceptions. The nature of exceptions is that they are of a particular type, so why have no access to that concept when trying to respond to them...
