How to modify exception messages form origiinal document

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
abdateAsked:
Who is Participating?
 
MadshiCommented:
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
 
shaneholmesCommented:
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
 
MadshiCommented:
Or, if you need something free for commercial purpose, have a look at the Jedi Debug unit.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
abdateAuthor Commented:
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
 
MadshiCommented:
Somewhere here:

http://www.delphi-jedi.org/
0
 
abdateAuthor Commented:
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
 
MadshiCommented:
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
 
abdateAuthor Commented:
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
 
MadshiCommented:
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
 
abdateAuthor Commented:
Yes, I prefer to hope someone could tell me how to modify message on HPP file.
0
 
MadshiCommented:
You're talking in riddles to me.
0
 
shaneholmesCommented:
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
 
shaneholmesCommented:
Ahhhhh, a newbe - be careful cause with grades like that experts will hesitate to answer you questions...


Shane
0
 
abdateAuthor Commented:
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
 
abdateAuthor Commented:
And I waited for your more detail answer more than 10 days.
0
 
MadshiCommented:
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
 
abdateAuthor Commented:
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
 
shaneholmesCommented:
as Madshi said, no one understand what you were talking about -

 HPP file ?

Shane
0
 
abdateAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.