www.digitalmars.com         C & C++   DMDScript  

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

reply A Guy With a Question <aguywithanquestion gmail.com> writes:
What's the clean way to extract the message that passes the 
nothrow argument? Do I really have to embed another try catch?
Nov 28 2017
next sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
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
Nov 28 2017
parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
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
Nov 28 2017
prev sibling parent reply A Guy With a Question <aguywithanquestion gmail.com> writes:
.msg worked. I will let you all live.
Nov 28 2017
parent A Guy With a Question <aguywithanquestion gmail.com> writes:
On Wednesday, 29 November 2017 at 00:52:41 UTC, A Guy With a 
Question wrote:
 .msg worked. I will let you all live.
Thanks!
Nov 28 2017