El 28/3/23 a les 0:45, Luca Olivetti via lazarus ha escrit:
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);

or

MyException:=TExceptionClass(ut.FatalException.ClassType).Create(Exception(ut.FatalException).message)

(TObject already has a ClassType, no need to cast it to Exception).




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...


Bye

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to