Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Exception (https://www.delphipraxis.net/9556-exception.html)

Alex_ITA01 29. Sep 2003 10:34


Exception
 
Servus ich hab da mal ne Frage zu Exceptions:

Problem: Exception In "C" gibt es eine art befehl der alle exceptions die auftreten können abfängt und behandelt.gibt es sowas auch in delphi? HandleException; oder HandleAllOther geht bei mir net wirklich.


gibts da ne möglichkeit?
danke
alex

Sanchez 29. Sep 2003 11:12

Re: Exception
 
Wenn du alle Exceptions deiner Anwendung in einer Funktione behandeln willst, definiere eine Prozedur im Mainform:

Delphi-Quellcode:
    procedure AppException(Sender: TObject; E: Exception);
Im FormCreate überschreibts du die OnException-Proz von Application

Delphi-Quellcode:
  Application.OnException := AppException;
In AppException kannst du die Exception abfangen.

grüße, daniel

Alex_ITA01 29. Sep 2003 11:14

Re: Exception
 
danke werde ich nachher gleich mal probieren
aber in der funktion (besser procedure) muss ich dann alle möglichen exceptions reinschreiben oder?

Sanchez 29. Sep 2003 11:19

Re: Exception
 
Um auf eine spezifische Exception zu reagieren musst du den Typ abfragen. Ich hab das bisher nur verwendet um alle Exceptions in einer Error-Log mitzuschreiben, da ist keine Abfrage nötig.

Alex_ITA01 29. Sep 2003 11:21

Re: Exception
 
trotzdem danke werds schon hinbekommen


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:19 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz