Really? -- Error: function `object.Throwable.message` is not nothrow

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Nov 29 00:14:16 UTC 2017


On Tuesday, November 28, 2017 23:48:06 Adam D. Ruppe via Digitalmars-d-learn 
wrote:
> On Tuesday, 28 November 2017 at 23:41:28 UTC, A Guy With a
>
> Question wrote:
> > What's the clean way to extract the message that passes the
> > nothrow argument? Do I really have to embed another try catch?
>
> I didn't even know it had a `message`... you should be able to
> pull the `.msg` member directly though, which is a simple string
> and not a function at all.
>
> http://dpldocs.info/experimental-docs/object.Throwable.html

I think that message was added recently for the folks at Sociomantic,
because they want to be able to reuse buffers for exception messages rather
than passing them as string like is normally done. So, they can override
message to provide the message instead of using msg. I have no idea why it
wouldn't be nothrow though. That was probably an oversight. Regardless, if
you're not doing anything with overriding message in your own code, then
using msg should work just fine.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list