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