> Hi all
> 
> Perhaps this is an stupid question, but I'm confused at this point:
> 
> I'm trying to implement a custom error message window with information
> about an error raised within a CATCH clause, using the Error class from
> Gambas. Here is the code I'm not able to get it working:
> 
> _The error form 'FError'_
> 
> PRIVATE $error AS String
> 
> PUBLIC SUB Form_Open()
>     ME.Center
>     txtError.Clear
>     txtError.Text = $error
> END
> 
> PUBLIC SUB showError(myError AS Error)
>     $error &= "[Error]\n" & myError.Text
>     $error &= "\n[Where]\n" & myError.Where
>     $error &= "\n[Backtrace]\n" & myError.Backtrace
>     ME.ShowModal
> END
> 
> PUBLIC SUB btnOk_Click()
>     IF chkReport THEN
>     ' TODO report error to a remote db
>     ENDIF
>     ME.Close
> END
> 
> _Calling in a sub after CATCH_
> 
> CATCH
>     FEerror.showError(Error)
> 
> -----
> 
> First of all, it is not possible to write "Error" keyword between the
> two parenthesis, being formatted into "ERROR", syntactically wrong.
> 
> If I enclose the 'Error' keyword between curly brackets, as in
> FErrors.showError({Error}) , no syntax error is raised, but a Gambas
> error saying "Type mismatch: wanted Error, got Class instead".
> 
> What am I doing wrong, or is it possible to use this class the way I'm
> doing?
> 
> Help appreciated!
> 
> Regards,
> 
> Jesús
> 

At the moment Error is a static class, you cannot instanciate it, and using it 
as a datatype is uselss. So don't use an argument, use the Error class 
everywhere.

The caveats of this design is that should save or use the Error class contents 
as soon as possible, otherwise another error or a function call may reset it.

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to