Miguel,

Sorry but you are mixing 2 different issues. The TRY construct in all  
those languages will still raise the exception, if you have any  
error. The CATCH syntax simply allows you to have different catchers  
for different errors, at different levels. Those samples you posted  
function exactly like this:

    TRY
         ? a /0
    CATCH e
         SWITCH e:genCode
              CASE EG_ZERODIV
                  ? "Caught division by 0"
                  EXIT

               DEFAULT
                    Throw( e )
          END
    FINALLY
          ? " In finally"
    END

As to the recursive limits of FOR EACH and WITH OBJECT, I'll try to  
remove the limit as as I get a chance, or you can do it if you need  
it sooner.

Ron

On Jun 26, 2008, at 1:24 AM, Miguel Angel Marchuet wrote:

> English is not my native language, but i try to explain better as  
> possible.
>
> Sometimes we need that TRY don't go to CATCH on 0 division exception.
> AS in other languages for example C++ or C# or java the CATCH  
> secuence can
> select the type of exception to catch (ERROR=EXCEPTION). Using  
> optional command
> [WITH <bError>] we can control the errors that can be cached.
>
> Example of code:
>
> TRY WITH {|o| MyError( o ) }
>
>       b := a / 0
>
> CATCH oErr
>     ...
> END TRY
>
> FUNCTION MyError( e )
>
>     // by default, division by zero yields zero
>     IF ( e:genCode == EG_ZERODIV )
>        RETURN 0
>     ENDIF
>
> RETURN .F.
>
> Example of code in C#:
>
>          try
>          {
>              Console.WriteLine("Executing the try statement.");
>              throw new NullReferenceException();
>          }
>          catch (NullReferenceException e)
>          {
>              Console.WriteLine("{0} Caught exception #1.", e);
>          }
>          catch
>          {
>              Console.WriteLine("Caught exception #2.");
>          }
>          finally
>          {
>              Console.WriteLine("Executing finally block.");
>          }
>
> Example of code in J#:
>
>        try
>        {
>           System.out.println("Executing the try statement.");
>           throw new NullPointerException();
>        }
>        catch(NullPointerException e)
>        {
>           System.out.println("Caught exception #1:" + e);
>        }
>        finally
>        {
>           System.out.println("Executing finally block.");
>        }
>
> Example of code in C:
>
> __try{
>     puts("in try");
>     __try{
>        puts("in try");
>        RAISE_AN_EXCEPTION();
>     }__finally{
>        puts("in finally");
>     }
> }__except( puts("in filter"), EXCEPTION_EXECUTE_HANDLER ){
>     puts("in except");
> }
>
>
> I see the nature of TRY in other languages can manage exceptions.
>
>
> And what about ?
>
> http://www.xharbour.com/support/bugreporter/index.asp? 
> page=detail&bug=87
>
> Best regards,
> Miguel Angel Marchuet
>
>
>
> ---------------------------------------------------------------------- 
> ---
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> xHarbour-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
>



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to