Solved

control The Exceptions

Posted on 2000-02-17
5
225 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 30 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

Suggested Solutions

Title # Comments Views Activity
Strange behavior when a form is closed 6 69
Delphi IDE crash without error message ... 7 118
Find and Replace Stream with 0s 8 73
Breakpoint doesn't stop in my variable 3 37
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

749 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