Skip to content

Instantly share code, notes, and snippets.

@viniciussanchez
Created November 18, 2022 13:41
Show Gist options
  • Save viniciussanchez/3178515d7254059813aa4d860e77c514 to your computer and use it in GitHub Desktop.
Save viniciussanchez/3178515d7254059813aa4d860e77c514 to your computer and use it in GitHub Desktop.
Classe para controlar as exceções em Delphi
unit Handler.Exception;
interface
uses System.SysUtils;
type
TMyHandlerException = class
private
class procedure GerarLog(E: Exception);
class procedure EnviarEmail(E: Exception);
public
class procedure DoHandlerException(Sender: TObject; E: Exception);
end;
implementation
uses Vcl.Dialogs, System.UITypes;
class procedure TMyHandlerException.DoHandlerException(Sender: TObject; E: Exception);
begin
GerarLog(E);
EnviarEmail(E);
MessageDlg('Aconteceu um erro, mas não se preocupe, já avisamos a equipe do suporte!', mtError, [mbOK], 0);
end;
class procedure TMyHandlerException.EnviarEmail(E: Exception);
begin
end;
class procedure TMyHandlerException.GerarLog(E: Exception);
begin
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment