Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to modify exception messages form origiinal document

Posted on 2004-04-12
19
Medium Priority
?
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
  • 4
19 Comments
 
LVL 11

Assisted Solution

by:shaneholmes
shaneholmes earned 80 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 80 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

609 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