Autor Beitrag
Jojojoxx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 14.02.08 10:11 
Hallo!

Kann ich, wenn ich eine try...except Anweisung habe und ein Fehler auftritt, auf Wunsch im except-Block diese Fehlermeldung irgendwie ausgeben?
Danke euch!

mfg

Jojo
Alpha_Wolf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 297

Ubuntu, Win XP, Win Vista
C#, Delphi 6 Prof, Delphi 2007 Prof, Java
BeitragVerfasst: Do 14.02.08 10:26 
Kurz gesagt ja du kannst ;)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
try
  .
  .
  .
  except
    on E: Exception do begin
      ShowMessage(E.Message);
    end;
  end;

_________________
Diskutiere nie mit einem Irren - er zieht dich auf sein Niveau und schlägt dich mit seiner Erfahrung.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 14.02.08 11:28 
Super!
Vielen Dank! :-)
mfg

Jojo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 14.02.08 17:31 
Moin!

Alternative: ;)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
try
  //...
except
  ShowMessage(Exception(ExceptObject).Message);
end;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Do 14.02.08 19:26 
Hallo,

wenn du im Except-Block nur etwas noch machen willst, um den Fehler nicht ganz so schlimm werden zu lassen, dann könnte dir diese Konstruktion weiterhelfen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
try
  (...)
except
  (...)
  raise;
end;

Der Fehler wird ganz normal weitergeleitet, bis er auf irgendeine Except-Konstruktion trifft, die den Fehler nicht mehr weiter gibt. Im Normalfall erledigt das dann Delphi.

Grüße,
Yogu