mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-06 17:05:34 +00:00
49 lines
1.1 KiB
ObjectPascal
49 lines
1.1 KiB
ObjectPascal
unit Sentry.Client.Vcl;
|
|
|
|
interface
|
|
|
|
uses
|
|
System.SysUtils,
|
|
Sentry.Client;
|
|
|
|
type
|
|
TSentryClientVcl = class(TSentryClient)
|
|
private
|
|
procedure HandleApplicationException(Sender: TObject; E: Exception);
|
|
public
|
|
constructor Create(AOptions: TSentryClientOptions; const ALogger: string; AFlags: TSentryClientFlags); override;
|
|
destructor Destroy; override;
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Vcl.Forms;
|
|
|
|
{ TSentryClientVcl }
|
|
|
|
constructor TSentryClientVcl.Create(AOptions: TSentryClientOptions;
|
|
const ALogger: string; AFlags: TSentryClientFlags);
|
|
begin
|
|
inherited Create(AOptions, ALogger, AFlags);
|
|
|
|
if scfCaptureExceptions in AFlags then
|
|
begin
|
|
Application.OnException := HandleApplicationException;
|
|
end;
|
|
end;
|
|
|
|
destructor TSentryClientVcl.Destroy;
|
|
begin
|
|
inherited Destroy;
|
|
if (TMethod(Application.OnException).Code = @TSentryClientVcl.HandleApplicationException)
|
|
and (TMethod(Application.OnException).Data = Self) then
|
|
Application.OnException := nil;
|
|
end;
|
|
|
|
procedure TSentryClientVcl.HandleApplicationException(Sender: TObject; E: Exception);
|
|
begin
|
|
SentryHandleException(E);
|
|
end;
|
|
|
|
end.
|