Avatar of sica79
sica79
 asked on

URGENT: raising an exception

var cds:TClientDataSet;
 ....
 try
   cds.Post;
 except
   HERE      (***)
 end;
 ....
 
 If Post has a error then the flow cotrol arrives
in module DBTables.pas and explicitely call this
 raise EDBEngineError.Create(ErrorCode);

How can I get this ErrorCode in my application
and do something HERE (***)
 
 thanks
Delphi

Avatar of undefined
Last Comment
Computer101

8/22/2022 - Mon
Cesario Lababidi

Hi sica79,

try
  cds.Post;
except
  OE E: Exception do
   ShowMessage( E.Message);
end;

good luck

Cesario
Cesario Lababidi

try
 cds.Post;
except
 ON E: Exception do
   Begin
     ShowMessage( E.Message);
   End;

end;
mocarts

var
  cds: TClientDataSet;
  i: integer;
begin
try
  cds.Post;
except
  on e: EDBEngineError do
  begin
    for i := 0 to e.ErrorCount -1 do
      if e.Errors[i].ErrorCode = CODE_TO_HANDLE then
        HandleThisErrorCode;
  end;
end;
end;

wbr, mo.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
kretzschmar

or use the onPostError-event instead
sica79

ASKER
Hi men!

It's still doesn't work!
never reaches   on e: EDBEngineError
I've tried even on e: Exception thinking is more general
but doesn't work

??????

thanks anyway
kretzschmar

and again,
or use the onPostError-event instead
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
sica79

ASKER
Hi world!

I did it!

I found the OnReconcileError event of
the ClientDataSet component.
This Event has a E: EReconcileError parameter
and i used  E.ErrorCode  to take my error !

thanks
Igor UL7AAjr

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ/Refund
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
ITugay
CleanupPing

sica79:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
kacor

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       PAQ and refund points
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Computer101

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.