Jump to content

Recommended Posts

Posted

Folks,

at VCL, I did exception handling with TApplicationEvents.OnException

All exceptions burst in this routine, I treated the way to display the message according to the type of exception, if it was a controlled exception, it shows a simple message, if not, it shows some other details.

Is it possible to do this centralization of exception in Unigui?

Through applicationevents it was not possible.

Posted

There is an event in servermodule may be it can help you (I have never used it). 

procedure TUniServerModule.UniGUIServerModuleException(
  Sender: TUniGUIMainModule; AException: Exception; var Handled: Boolean);
 

 

 

Posted
On 5/5/2020 at 12:22 PM, Mehmet Emin said:

There is an event in servermodule may be it can help you (I have never used it). 

procedure TUniServerModule.UniGUIServerModuleException(
  Sender: TUniGUIMainModule; AException: Exception; var Handled: Boolean);
 

 

 

Thanks, I will try.

  • 2 weeks later...
Posted

Also if you decide to use madExcept for bug reporting you can find the below code useful.

procedure TUniServerModule.UniGUIServerModuleException(
  Sender: TUniGUIMainModule; AException: Exception; var Handled: Boolean);
var
  CurSession : TUniGUISession;
begin
  if not (AException is EAbort) then
  begin
    if not (AException is UniErrorException) and
       not (AException is EUniSessionException) then
    begin
      CurSession := UniSession;
      if Assigned(CurSession) then CurSession.AlertDisabled := True;
      try
        AutoSaveBugReport(CreateBugReport(etNormal, nil, nil, 0, 0, 0, nil, false));
        Handled := True;
      finally
        if Assigned(CurSession) then CurSession.AlertDisabled := False;
      end;
    end;
  end;
end;
 

Posted

I'd like you conditionals.

I dont know if i will use madexcept, but thanks!

Based on my tests, assigning True to Handled, the standard unigui warning of the error is not displayed,

What would it be

AlertDisabled := True;

thanks!

Posted

Since there is no source code available for TUniGUISession and no documentation of this property except a usage in a demo for UniGUIAuxExceptionHandler with Eureka I looked at that code and thougth that if Farshad Mohajeri put this line here there should be a reason. I could not see a difference in my case but I keep it there anyway. I think it is there to disable web user feed with dumps etc. in case something goes wrong (I dont see any different).

 

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...