[Gambas-user] Try;If Error on mutable classes
Ian Haywood
ihaywood3 at ...626...
Mon May 12 13:18:39 CEST 2014
On Mon, May 12, 2014 at 11:07 AM, B Bruen <bbruen at ...2308...> wrote:
> OK,this has me beat.
> So, we try(sic) as follows:
> 1: Try MyObject.MissingMethod(whatever)
> 2: If Error then
> 3: Error Subst("&1\nERR: &2 (&3)\n&4\n&1\n", String$(40, "-"), Error.Text, Error.Code, Error.Backtrace.Join("\n"))
> 4: Endif
>
> Line 3 fails with a null (Error) object.
>
> There seems to be two problems here.
> 1) Why is the Error instance a null, and
are you sure the whole Error is Null
is it just Error.Backtrace?
which isn't set by the TRY form (it is when you handle errors using CATCH)
> 2) (Harder) If, when trying to invoke an unknown method in a classifier then should not the interpreter raise the normal error " Unknown Symbol blah blah"
when I'm not sure if a method exists on a Form I use Object.Call which
seems to behave a bit better in this circumstance.
Ian
More information about the User
mailing list