Closed nwolek closed 10 years ago
In the absence of documentation, you can look to see if any of the code you execute uses a "throw" statement. The TTObject constructor, for example, contains this nugget: https://github.com/jamoma/JamomaCore/blob/master/Foundation/library/includes/TTObject.h#L46
The destructor throws no such exceptions, unless there is one buried inside of the function that it calls, etc.
Thanks for the clear explanation via that nugget. Should we mirror that code in the destructor so that it DOES throw an exception? It seems like a net loss if we used to get error reporting here, but now we don't. Then again, maybe it was never an issue on deletion.
The question is, did ever actually return an error or did it always just return zero?
--••• •••--
On Wed, Nov 13, 2013 at 7:50 AM, nwolek notifications@github.com wrote:
Thanks for the clear explanation via that nugget. Should we mirror that code in the destructor so that it DOES throw an exception? It seems like a net loss if we used to get error reporting here, but now we don't. Then again, maybe it was never an issue on deletion.
— Reply to this email directly or view it on GitHubhttps://github.com/jamoma/JamomaCore/issues/171#issuecomment-28395175 .
I followed the trail...
TTObject destructor calls ttEnvironment->releaseInstance releaseInstance currently always returns kTTErrNone BUT
Thinking this through some more: TTObject is effectively passing a version of itself to the TTEnvironment when it calls the releaseInstance method. If it were invalid, it would not be able to call the method in the first place. So it makes sense that errors would happen during constructor but not destructor.
OK, I am closing this question.
Noticing that in the new object instantiation syntax, I need to catch exceptions like this:
But when I delete an object, I just do this:
Is there a possibility of an uncaught exception out of the delete command? Before we had to do this:
To be clear: the compiler does not complain. This is more me being curious about why one has the potential for errors and the other does not.