Solved

How to modify exception messages form origiinal document

Posted on 2004-04-12
19
343 Views
Last Modified: 2010-04-05
Hello!

I use Delphi 5. I try to modify exception messages original document. Because I may code "try .. catch" for every critical parts and it works, but it is not so easy to watch every step in full project . May I modify original exception messages  documents and after that, program could show "my special messages"  during catch error exceptions.
Thanks!

Regards,
abdate
0
Comment
Question by:abdate
  • 8
  • 7
  • 4
19 Comments
 
LVL 11

Assisted Solution

by:shaneholmes
shaneholmes earned 40 total points
ID: 10807335
Yould assign your own OnExecption event to the Application Object, trapping all exceptions at th Application object level.

Then use a Case statement to test for a partuclar Exception and do something.....

Shane

procedure TForm1.MyException(Sender: TObject; E: Exception);
begin
 case E of
  //
 end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 Application.OnException:= MyException;
end;

0
 
LVL 20

Accepted Solution

by:
Madshi earned 40 total points
ID: 10807760
I'm not sure what you mean. Perhaps you should look here:

http://help.madshi.net/madExcept.htm

It's free for non-commercial usage.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10807764
Or, if you need something free for commercial purpose, have a look at the Jedi Debug unit.
0
 

Author Comment

by:abdate
ID: 10810275
Thanks shanehomes!
I only try to catch some specific Exception message. but I don't know their handle code.
how to know these handle code.

And Thanks Madshi!
Where is Jedi Debug unit?
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10811315
Somewhere here:

http://www.delphi-jedi.org/
0
 

Author Comment

by:abdate
ID: 10818702
Thanks Madshi!

I will check delphi-jedi web later.
By the way, I found only E.Classname & E.message I can get from VCL exception. I do't know any error code I can get, do I? May be I could get some other codes from WINAPI?

Regards,
abdate
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10820785
To be honest: I've still not fully understood your original question. Perhaps you can explain it again in other words? Perhaps with some examples?
0
 

Author Comment

by:abdate
ID: 10828342
Thanks Madshi!

I have a project with many different FormStyle forms. I try to find out an easy way to catch and change some specific exception messages such as "ADOQuery1: Dataset not in edit mode or insert mode", "Cannot insert null into..." and etc..

My orginal idea is trying to change SYSUTILS.HPP or any other HPP file, but I cannot locate these "message".
Then I read Borland HELP file, the description is same as you mentioned before. Using this method, I hope to catch exception code instead of exception message because of its too long words. And I am not sure Delphi provide VCL exception code.

Regards,
abdate
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10830522
You're asking for two things now: (1) Change a specific exception message. And (2) catch the exception code. What do you mean with (2)?

It seems like Shane understood you better than I did. His comment could do what you want. In his "TForm1.MyException" you can check out "E.ClassName" and "E.Message". Also you can probably modify "E.Message".
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:abdate
ID: 10830792
Yes, I prefer to hope someone could tell me how to modify message on HPP file.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10830821
You're talking in riddles to me.
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10910498
Why you gave a grade of C,

My answer was what you were looking for

procedure TForm1.MyException(Sender: TObject; E: Exception);
begin
// SHowMessage(E.Message);
//or

//case E of
//  SOme error : begin
//                      end;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 Application.OnException:= MyException;
end;


Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10910504
Ahhhhh, a newbe - be careful cause with grades like that experts will hesitate to answer you questions...


Shane
0
 

Author Comment

by:abdate
ID: 10910520
Hi, shaneholmes,

I am so Sorry that gave a grade of C,
I suppose someone could answer how to modify HPP file for Exception. By the way, Your answer I got from HELP file.
0
 

Author Comment

by:abdate
ID: 10910544
And I waited for your more detail answer more than 10 days.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10910784
You would have gotten a better answer if you had actually explained your problem in a way that we can understand. As I hinted in my previous comment, I didn't understand (and still don't understand) your problem.
0
 

Author Comment

by:abdate
ID: 10910834
Yes, these answers are not really my requirement and I still accept them because I want to thanks your effort and give my points. Next time I will do my best when I ask.
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10912090
as Madshi said, no one understand what you were talking about -

 HPP file ?

Shane
0
 

Author Comment

by:abdate
ID: 10912493
I am sorry I forgot HPP is not using in Delphi. HPP using in BCB.
By the way, I mean Could I modify some core program in VCL or dcu or Exception handling routines... to change these Eception message.

abdate


 
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now