Re: List of exceptions?

2020-10-12 Thread Ali Çehreli via Digitalmars-d-learn
On 10/12/20 2:11 AM, Dominikus Dittes Scherkl wrote: > - Throw exceptions only if you have a plan what to do with them if you > catch them. My thinking is different: Throw exceptions if you can't accomplish a task. My code is filled with enforce() and assert() checks, which do throw

Re: List of exceptions?

2020-10-12 Thread DMon via Digitalmars-d-learn
... - ...no plan, better throw error...where and why the program crashed... Therefore a list of possible exceptions doesn't make any sense. Thanks, Dominikus, those are great ideas.

Re: List of exceptions?

2020-10-12 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
your own. - Throw exceptions only if you have a plan what to do with them if you catch them. - If you have no plan, better throw error, just to get an idea where and why the program crashed (and don't try to catch them) Therefore a list of possible exceptions doesn't make any sense.

Re: List of exceptions?

2020-10-10 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 10 October 2020 at 20:32:22 UTC, DMon wrote: On Saturday, 10 October 2020 at 19:55:44 UTC, Ali Çehreli wrote: On 10/10/20 12:51 PM, DMon wrote: Thank you for your and Imperatorns time. Even if it did go in circles and get stuck in the mud. No problem. We're doing it out of

Re: List of exceptions?

2020-10-10 Thread DMon via Digitalmars-d-learn
On Saturday, 10 October 2020 at 19:55:44 UTC, Ali Çehreli wrote: On 10/10/20 12:51 PM, DMon wrote: Thank you for your and Imperatorns time. Even if it did go in circles and get stuck in the mud.

Re: List of exceptions?

2020-10-10 Thread Ali Çehreli via Digitalmars-d-learn
On 10/10/20 12:51 PM, DMon wrote: > I will copy that down. > > The idea for specific exceptions came from the online docs and > Programing in D, 39.2 The try-catch statemet > > try > { // the code block that is being executed, where an // exception may be > thrown > } > catch (an_exception_type)

Re: List of exceptions?

2020-10-10 Thread DMon via Digitalmars-d-learn
On Saturday, 10 October 2020 at 18:16:45 UTC, Ali Çehreli wrote: On 10/10/20 9:16 AM, DMon wrote: > catch (Exception e) // implicit (any exception) > catch (ConvException f) // explicit (conversion only) > > Or is that not correct? I think in class hierarchies, "more general" and "more

Re: List of exceptions?

2020-10-10 Thread Ali Çehreli via Digitalmars-d-learn
On 10/10/20 9:16 AM, DMon wrote: > catch (Exception e) // implicit (any exception) > catch (ConvException f) // explicit (conversion only) > > Or is that not correct? I think in class hierarchies, "more general" and "more specific" are better terms. :) The answer is, catch by the most

Re: List of exceptions?

2020-10-10 Thread DMon via Digitalmars-d-learn
On Saturday, 10 October 2020 at 16:37:23 UTC, Imperatorn wrote: On Saturday, 10 October 2020 at 12:12:35 UTC, DMon wrote: To clarify, do you want a list of *possible* exceptions, like in Java? Please. I've been looking and thinking that I'm over complicating it for myself so it may

Re: List of exceptions?

2020-10-10 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 10 October 2020 at 12:12:35 UTC, DMon wrote: Is there a list of a list of the exceptions or what can be used with catch? I'm thinking that I missed it and there is something easier than breaking old code, scouring the site, or hypnotic regression. To clarify, do you want

Re: List of exceptions?

2020-10-10 Thread DMon via Digitalmars-d-learn
On Saturday, 10 October 2020 at 16:00:26 UTC, Ali Çehreli wrote: On 10/10/20 8:46 AM, DMon wrote: On Saturday, 10 October 2020 at 14:56:31 UTC, Ali Çehreli wrote: On 10/10/20 5:12 AM, DMon wrote: Is there a list of a list of the exceptions or what can be used with catch? Only Throwable

Re: List of exceptions?

2020-10-10 Thread Ali Çehreli via Digitalmars-d-learn
On 10/10/20 8:46 AM, DMon wrote: On Saturday, 10 October 2020 at 14:56:31 UTC, Ali Çehreli wrote: On 10/10/20 5:12 AM, DMon wrote: Is there a list of a list of the exceptions or what can be used with catch? Only Throwable and classes that are derived from it can be thrown and caught. Ali

Re: List of exceptions?

2020-10-10 Thread DMon via Digitalmars-d-learn
On Saturday, 10 October 2020 at 14:56:31 UTC, Ali Çehreli wrote: On 10/10/20 5:12 AM, DMon wrote: Is there a list of a list of the exceptions or what can be used with catch? Only Throwable and classes that are derived from it can be thrown and caught. Ali Thanks for the reply. I am

Re: List of exceptions?

2020-10-10 Thread Ali Çehreli via Digitalmars-d-learn
On 10/10/20 5:12 AM, DMon wrote: Is there a list of a list of the exceptions or what can be used with catch? I'm thinking that I missed it and there is something easier than breaking old code, scouring the site, or hypnotic regression. Only Throwable and classes that are derived from it can

List of exceptions?

2020-10-10 Thread DMon via Digitalmars-d-learn
Is there a list of a list of the exceptions or what can be used with catch? I'm thinking that I missed it and there is something easier than breaking old code, scouring the site, or hypnotic regression.