Re: Exception oder bool=true, false ???

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Sascha Andres (sascha.andres_at_keatec.com)
Date: 04/20/04


Date: Tue, 20 Apr 2004 11:06:00 +0200

Hallo,
Maik Pütz wrote:
> Reicht die Funktion so aus wie sie ist, oder sollte ich
> mir lieber selber Exception schreiben, damit ich darauf in
> meinem Hauptprogramm reagieren kann? Datenbankserver läuft
> nicht, oder Datenbank schon vorhanden...
>
> Wie würdet Ihr an so etwas herangehen?

je nachdem. Die Exception weiterzugeben ist die empfohlene Art Weise mit
einer Exception umzugehen. Exceptions benötigen jedoch Zeit. In einer
zeitkritischen Operation würde ich daher vermeiden (müssen), eine
eitere Exception zu feuern. Jedoch gebe ich im Regelfall nicht einen
bool Wert zurück, sondern einen Wert einer Enum, so kann ich die bei
Bedarf erweitern, um Einträge, die mich in der aufrufenden Funktion den
Fehler besser/anders behandeln lassen.

Wenn irgend möglich bevorzuge ich jedoch den Weg über try/catch, dies
stellt IMHO eine deutlich übersichtlichere Art der Fehlerbehandlung dar.

-sa

-- 
http://www.livingit.de
http://www.mobile-bookmarks.info
http://www.not2long.net


Relevant Pages

  • Re: MDB Performance Frage
    ... Da in der CSV maximal 5-10% _neue_ Daten sind und der Rest über OleDBException verworfen wird frage ich mich ob das so toll ist. ... Ein Exception ist immer maximaler Stress für die CLR, da alle Aufrufebenen mehrmals durchlaufen werden, um festzustellen, wo letztendlich die Ausnahmebehandlung auszuführen ist und welche Finally's noch abzuabreiten sind. ... Die CSV über die Jet mit "IN" zu importieren dauert zu lange ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • Re: Blues in F?
    ... many of the note choices I make, ... bad art, they are also the key to great art. ... There is no "exception to the rules". ... and just throwing a bunch of random shit around because you ...
    (alt.guitar.bass)
  • Re: Scale lesson....
    ... there is a considerable difference between science and art. ... I like gravity, for several reasons. ... Most people use the term 'exception that proves the rule' incorrectly. ...
    (alt.guitar.bass)
  • Re: Doctor Who: production roundup
    ... I just take exception to the uncritical touchy feely ... soundbite. ... of it being art and pay top dollar for it. ... Now is the time time to declare your allegiance! ...
    (rec.arts.drwho)
  • Re: Is art school worthless?
    ... The exception is the ... degree in art. ... About half of them went to art school, and half of those, ... cultural renaissance, but I see none. ...
    (rec.arts.fine)