Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
YAQ on nested TRY
Message
 
 
À
17/05/2009 12:37:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01400278
Message ID:
01400286
Vues:
33
>>
>>Gregory,
>>
>>Thank you very much for your help. I used your simple example and now understand better how the nested TRY/CATCH works.
>
>No hay de que, dijo Gregorio
>
>Notes
>(1) There has to be a catch block even if it's empty
>
>	local a, b
>	b = 'aa'
>
>	&& nothing will be printed here
>	try 
>		try
>			a = 3/b
>			?a
>		catch
>		
>		endtry
>	
>	catch
>		?'outer'
>	
>	endtry
>
>(2) Omitting the (inner) CATCH results in an error (unhandled exception) when there's an error in the inner try
>It is caught by the outer try
>
>	local a, b
>	b = 'aa'
>
>	&& outer
>
>	try 
>		try
>			a = 3/b
>			?a
>		endtry
>	
>	catch
>		?'outer'
>	
>	endtry
>
>(3) When there's no error in the inner try there's no outer catch
>[ one may argue why you write a try without catch]
>
>
>	local a, b
>	b = 'aa'
>	
>
>	try 
>		try
>			a = 3/1
>			?a
>		endtry
>	
>	catch
>		?'outer'
>	
>	endtry
>
Muchas gracias de nuevo. I always have a CATCH even if sometimes I have no code there. The purpose is to simply suppress the error.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform