Am 01.06.2018 um 21:14 schrieb Ondrej Pokorny:
Hello,

is there any reason the OnShowException event is ignored for console applications?

The OnShowException event is a feature of FPC (Delphi doesn't have it), so whoever added it probably thought that it makes more sense this way 🤷‍♀️


Why not so:

procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
// use shortstring. On exception, the heap may be corrupt.
Var
  Buf : ShortString;
begin
SetLength(Buf,ExceptionErrorMessage(ExceptObject,ExceptAddr,@Buf[1],255));
  If Assigned(OnShowException) Then
    OnShowException (Buf)
  Else
  If IsConsole Then
    writeln(Buf)
end;
If no one objects I'd be inclined to swap it around this way. 😊

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to