We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How to modify exception messages form origiinal document

abdate
abdate asked
on
Medium Priority
370 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
Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
Or, if you need something free for commercial purpose, have a look at the Jedi Debug unit.

Author

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?

Commented:
Somewhere here:

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

Author

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

Commented:
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?

Author

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

Commented:
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".

Author

Commented:
Yes, I prefer to hope someone could tell me how to modify message on HPP file.

Commented:
You're talking in riddles to me.
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
Ahhhhh, a newbe - be careful cause with grades like that experts will hesitate to answer you questions...


Shane

Author

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.

Author

Commented:
And I waited for your more detail answer more than 10 days.

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

Author

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.
as Madshi said, no one understand what you were talking about -

 HPP file ?

Shane

Author

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


 
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.