?
Solved

control The Exceptions

Posted on 2000-02-17
5
Medium Priority
?
233 Views
Last Modified: 2010-04-04
i'am working Cgi App And i Recieve An Http Error...
Exception:EDataBaseError,how can i control any errors and display my own ErrMsg When it Occurs.
thanks.
0
Comment
Question by:mirghani
[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
5 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2530530
You can do something like this:

try
  // Do you stuff here
except // Oops, something bad happened
  on E : EDatabaseError do
    ShowMessage('An error occured during x'+#10#13+E.message);
end;

Cheers,

Raymond.
0
 

Author Comment

by:mirghani
ID: 2530546
can showmessage be displayed within web pages
0
 
LVL 15

Expert Comment

by:simonet
ID: 2531133
>can showmessage be displayed within web pages

No, you have to throw the error message in PageProducer.Contents

Alex
0
 
LVL 17

Accepted Solution

by:
geobul earned 120 total points
ID: 2531147
Hi,

  In my programs I have a global string variable (MyError for example) where I can store multiline error description.
  With 'try...except' block in except part I assign a value to this variable and then send an error page as response.

Example:

procedure TDBModule.DBModuleWebActionItem2Action(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
  MyError := '';
  Handled := False;
  try
    .......
  except
    on E : EDatabaseError do
      MyError := 'Database Error';
    on ...
  end;
  if MyError <> '' then begin
    Response.Content := '<HTML><BODY>'+MyError+</BODY></HTML>;
    Handled := True;
    Response.SendResponse;
  end;
end;

Actually, I use "Response.Content := ErrorPP.Content;" with PageProducer for custom error pages and a <#tag> for the error string.

Regards, Geo
0
 

Author Comment

by:mirghani
ID: 2537737
Thanks geo:-).
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

752 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