[Issue 16121] the canonical way to create and use an exception type is not documented on dlang.org

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jun 4 15:04:25 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16121

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #1 from ag0aep6g at gmail.com ---
(In reply to Piotr from comment #0)
> As a new D user I need basic information, for example if an exception should
> be a class or struct, what class it should inherit from,
> and what is a good
> or typical way to pass exception message in D. 
> An example that I can easily spot and analyze would be by far the best way
> to provide this.

Must be a class that inherits from Throwable. And usually you inherit from
Exception.

> I've been searching for this but could not find such example.
> When I search for "dlang exception handling", the first page that google
> redirects me to is:
> https://dlang.org/spec/errors.html
> It doesn't contain the needed info.
> Then I tried to navigate manually to a page that should contain the
> information. I landed on:
> https://dlang.org/exception-safe.html
> No luck there either.

One page you should be able to find is this:
https://dlang.org/library/object/exception.html

I agree that there should be a document describing the matter. Maybe there is
and we both just can't find it.

--


More information about the Digitalmars-d-bugs mailing list