chongkeng_woon
asked on
Exception.Create() problem in ISAPI Web DLL
Good Morning:
I am currently converting my Delphi Win32 application to ISAPI DLL Web Server Application.
I have done some experiments with Exception.Create function in both projects:
For Delphi Win32 application, Exception.Create() function generate dialog box with OK button, once i click that OK button, it exits from all the functions/procedures and return nothing.
This is how Exception works ..(see attached code: Part A)
But, for ISAPI DLL Web Server Applications, it return me the "Internal Server Error", i know it is because the dialog box problem ....(see attached code: Part B)
my question is :
is there anyway to use other function instead of Exception.Create() in my DLL project so that wherenever exception is met, my DLL can exit from all the functions/procedures without generating an error?
thanks
Part A:
procedure TForm1.Button1Click(Sender : TObject);
begin
if TestFunction then
showmessage('hello');
end;
function TForm1.TestFunction:Boolea n;
procedure RaiseException(const msg : string);
begin
raise Exception.Create(msg);
end;
var
a : integer;
begin
result := false;
a := 1;
if a = 1 then
RaiseException('Wrong Data');
result := true;
end;
Part B:
procedure TWebModule1.WebModule1WebA ctionItem1 Action(Sen der: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
if TestFunction then
response.content := 'testing completed';
end;
function TWebModule1.TestFunction:B oolean;
procedure RaiseException(const msg : string);
begin
raise Exception.Create(msg);
end;
var
a : integer;
begin
result := false;
a := 1;
if a = 1 then
raiseexception('Wrong Data');
result := true;
end;
I am currently converting my Delphi Win32 application to ISAPI DLL Web Server Application.
I have done some experiments with Exception.Create function in both projects:
For Delphi Win32 application, Exception.Create() function generate dialog box with OK button, once i click that OK button, it exits from all the functions/procedures and return nothing.
This is how Exception works ..(see attached code: Part A)
But, for ISAPI DLL Web Server Applications, it return me the "Internal Server Error", i know it is because the dialog box problem ....(see attached code: Part B)
my question is :
is there anyway to use other function instead of Exception.Create() in my DLL project so that wherenever exception is met, my DLL can exit from all the functions/procedures without generating an error?
thanks
Part A:
procedure TForm1.Button1Click(Sender
begin
if TestFunction then
showmessage('hello');
end;
function TForm1.TestFunction:Boolea
procedure RaiseException(const msg : string);
begin
raise Exception.Create(msg);
end;
var
a : integer;
begin
result := false;
a := 1;
if a = 1 then
RaiseException('Wrong Data');
result := true;
end;
Part B:
procedure TWebModule1.WebModule1WebA
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
if TestFunction then
response.content := 'testing completed';
end;
function TWebModule1.TestFunction:B
procedure RaiseException(const msg : string);
begin
raise Exception.Create(msg);
end;
var
a : integer;
begin
result := false;
a := 1;
if a = 1 then
raiseexception('Wrong Data');
result := true;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.