Jump to content

centralized exceptions


LogSistemas01

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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;
 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...