Re: Exception slipping through the catch block?

2018-11-08 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 09, 2018 at 01:14:08AM +, Neia Neutuladh via Digitalmars-d-learn wrote: [...] > This isn't, strictly speaking, safe. Your program detected an error, > and in Walter's book, that means you can't trust the program to do > *anything*. Unwinding the stack, formatting a stacktrace,

Re: Exception slipping through the catch block?

2018-11-08 Thread Neia Neutuladh via Digitalmars-d-learn
On Thu, 08 Nov 2018 17:27:40 -0700, Jonathan M Davis wrote: > You ran into one of the rare cases where it makes sense catch an Error > or a Throwable, and you're one of the few people who understands the > situation well enough to deal with it properly. The vast majority of D > programmers don't.

Re: Exception slipping through the catch block?

2018-11-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 8, 2018 2:34:38 PM MST H. S. Teoh via Digitalmars-d- learn wrote: > On Thu, Nov 08, 2018 at 01:28:47PM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > > On Thursday, November 8, 2018 10:55:45 AM MST Stanislav Blinov via > > > > Digitalmars-d-learn wrote: > > > On

Re: Exception slipping through the catch block?

2018-11-08 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 08, 2018 at 01:28:47PM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > On Thursday, November 8, 2018 10:55:45 AM MST Stanislav Blinov via > Digitalmars-d-learn wrote: > > On Thursday, 8 November 2018 at 16:13:55 UTC, Mike Parker wrote: [...] > > > No, you should never catch

Re: Exception slipping through the catch block?

2018-11-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 8, 2018 10:55:45 AM MST Stanislav Blinov via Digitalmars-d-learn wrote: > On Thursday, 8 November 2018 at 16:13:55 UTC, Mike Parker wrote: > > On Thursday, 8 November 2018 at 15:50:38 UTC, helxi wrote: > >> Although it's pretty frustrating, isn't it? Now not only I > >> have

Re: Exception slipping through the catch block?

2018-11-08 Thread Stanislav Blinov via Digitalmars-d-learn
On Thursday, 8 November 2018 at 16:13:55 UTC, Mike Parker wrote: On Thursday, 8 November 2018 at 15:50:38 UTC, helxi wrote: Although it's pretty frustrating, isn't it? Now not only I have to think about catching exceptions but also about Errors, and have no guarantee that I have everything

Re: Exception slipping through the catch block?

2018-11-08 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 8 November 2018 at 15:50:38 UTC, helxi wrote: On Thursday, 8 November 2018 at 15:41:11 UTC, Adam D. Ruppe wrote: On Thursday, 8 November 2018 at 15:08:40 UTC, helxi wrote: Shouldn't the catch block in the function catch the exception? You caught Exception, but it throws Error.

Re: Exception slipping through the catch block?

2018-11-08 Thread Bauss via Digitalmars-d-learn
On Thursday, 8 November 2018 at 15:50:38 UTC, helxi wrote: On Thursday, 8 November 2018 at 15:41:11 UTC, Adam D. Ruppe wrote: On Thursday, 8 November 2018 at 15:08:40 UTC, helxi wrote: Shouldn't the catch block in the function catch the exception? You caught Exception, but it throws Error.

Re: Exception slipping through the catch block?

2018-11-08 Thread helxi via Digitalmars-d-learn
On Thursday, 8 November 2018 at 15:41:11 UTC, Adam D. Ruppe wrote: On Thursday, 8 November 2018 at 15:08:40 UTC, helxi wrote: Shouldn't the catch block in the function catch the exception? You caught Exception, but it throws Error. They have separate inheritance trees. The common ancestor

Re: Exception slipping through the catch block?

2018-11-08 Thread Alex via Digitalmars-d-learn
On Thursday, 8 November 2018 at 15:50:38 UTC, helxi wrote: Thanks. Although it's pretty frustrating, isn't it? Now not only I have to think about catching exceptions but also about Errors, and have no guarantee that I have everything under control. Isn't it rather the case, that you have

Re: Exception slipping through the catch block?

2018-11-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 8 November 2018 at 15:08:40 UTC, helxi wrote: Shouldn't the catch block in the function catch the exception? You caught Exception, but it throws Error. They have separate inheritance trees. The common ancestor is actually Throwable, though note that there is no guarantee that

Exception slipping through the catch block?

2018-11-08 Thread helxi via Digitalmars-d-learn
How does exception work? I am inside a function that calls a constructor. Inside the constructor, an exception is thrown. However even though I have wrapped the body of the function inside a try/catch block, the program crashes from inside that constructor. Shouldn't the catch block in the