[Gambas-user] Error as Boolean & ERROR as Class

Benoît Minisini gambas at ...1...
Thu Dec 27 07:41:41 CET 2012


Le 26/12/2012 00:01, Ian Roper a écrit :
> Greetings,
> Is there any way to pass the ERROR class as a parameter in a subroutine ?
> It always defaults to the Boolean type when used as below
>
>
> Global_Module
> Public Sub ManageError(MyError as ERROR)
>
>       Message.Error(MyError.Text & " Occured at " MyError.Class)
>    //Other error management handling/reporting
> End
>
> Calling from a form or class
>
> Global_Module.ManageError(ERROR)
>
> Gambas Error text "Wanted Error, got Boolean instead"
>
> Cordialemont,
>
> Ian Roper
> Warnbro
> Western Australia
>

Error is a static class. So there is no need to use it as an argument.

ERROR alone is a language keyword that returns TRUE if the last TRY 
instruction has raised an error. Well, this is not entirely true, but 
you should use it only in that context!

Regards,

-- 
Benoît Minisini




More information about the User mailing list