[fpc-devel] procedure ShowException
Sven Barth
pascaldragon at googlemail.com
Sat Jun 2 16:09:38 CEST 2018
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, at 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
More information about the fpc-devel
mailing list