[Gambas-user] Error.Backtrace

Benoît Minisini gambas at ...1...
Fri Jan 17 00:11:40 CET 2014


Le 16/01/2014 23:12, Ian Haywood a écrit :
> I have discovered that Error.Backtrace is not always correctly set.
> if an error occurs in a TRY expression Error.Backtrace remains with the
> previous error.
> Error.Where and Error.Text are set correctly.
>
> This caused us a lot of problems as we log Error.backtrace to find
> errors on user systems.
>
> I attach a mini-project that demonstrates this.
>
>

This is for performance reasons. Storing the stack backtrace can be an 
heavy process, so it is only done if there is a CATCH or a FINALLY or no 
error handler in the function.

For a TRY that does not call functions, it is not computed, so you get 
the previous stack backtrace.

I admit it is actually a bit weird, but I don't understand why it is a 
problem. You should use TRY when you really don't care with the error.

Anyway I will think about it. How to get a stack backtrace in all cases 
without having to copy the entire stack, most of the time for nothing.

-- 
Benoît Minisini




More information about the User mailing list