[Gambas-user] using try when access devices shadow the errors

Tony Morehen tmorehen at ajm-software.com
Thu Aug 2 19:50:21 CEST 2018


The wiki/documentation is perfectly clear about Try, Catch, and Finally. 
  Further, Tobias never said Catch shadows the error!

Try shadows the error, not Catch.  Catch is an error handler.  It 
behaves as an error handler should ie the error is handled, no need to 
raise an exception.

Here's the standard error process:

1) Fill in the Error object
2) Raise an exception

This is equivalent to On Error Goto 0

Error process with a Try at the start of statement

1) Fill in Error object
2) Resume at the statement following the Try

This is equivalent to:
     On Error Resume Next
     statement
     On Error Goto 0

Error process with a Catch block

1) Fill in the Error object
2) Resume at the statement following the Catch

This is equivalent to:
     On Error Goto Catch
     statements
     Return
    Catch
     error handling code
     Return

Error Process with Catch and Finally blocks

1) Fill in the Error object
2) Resume at the statement following the Catch
3) Execute the Finally code.  Finally code is executed even if there is 
no error.

This is equivalent to:
     On Error Goto Catch
     statements
     Goto Finally
    Catch
     error handling code
     Goto Finally
    Finally
     code that is always executed

A final word of caution  Criticizing the wiki as bluntly as you do, 
particularly when that criticism is unwarranted, is likely to irritate 
the people that provide us such an exceptional product.  Try framing 
this sort of criticism as a question, such as "Do we need to add 
something to the wiki to make this explicit and avoid confusing novices?"





On 2018-08-02 12:04 PM, PICCORO McKAY Lenz wrote:
> i cited that wiki does not say that error are shadowed by the catch! its 
> very important information for novices, taking in consideratino the 
> languaje barrier
> 
> seems we need more vision here!
> 
> 
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
> 
> 2018-08-02 11:56 GMT-04:00 Jussi Lahtinen <jussi.lahtinen at gmail.com 
> <mailto:jussi.lahtinen at gmail.com>>:
> 
> 
>         well i comming from java and C and its common ofr us use
>         try/cacht as duple
> 
> 
>     Incorrect. There is no try/catch in C.
> 
> 
>     Jussi
> 
> 
> 
>     ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> 
> 
> 
> 
> 
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> 



More information about the User mailing list