On Tue, 28 Mar 2023, Luca Olivetti via lazarus wrote:
El 28/3/23 a les 0:01, Michael Van Canneyt ha escrit:
My bad, I made a typo, it should have been
MyException:=ExceptionClass(ut.FatalException).ClassType).Create(Exception(ut.FatalException).message)
Thank you.
Actually it is
MyException:=TExceptionClass(Exception(ut.FatalException).ClassType).Create(Exception(ut.FatalException).message);
with ExceptionClass= class of exception;
Actually, I never write it like this in one statement,
Yep, it's quite a mouthful, I had to break it up to spot the error :-)
I save the class pointer and message
in local variables, do cleanup first and then use the class pointer and
message later to raise an exception. But the effect is the same: you create
a copy with the same class and message as the original.
But not with the same detail (i.e. any extra fields are missing).
Not that I'm really interested in them (usually I just use the message), but
still...
I am aware of that. But the extra fields are usually only interesting in the
debugger. You will see them if you inspect ut.FatalException. For the user
normally only the message is interesting.
Michael.
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus