Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error message from number
Message
 
 
À
25/01/2001 20:11:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00468523
Message ID:
00469041
Vues:
12
>>ON ERROR gnErrNum = ERROR() AND gcErrMess = MESSAGE()

>This does not do an assignment, but would assert a logical condition without any assignment, and might cause an error in itself. You could call a procedure and pass the arguments to it, doing the assignment there; I'd recommend creating an error object, perhaps as an adjunct to your app object, rather than passing around globals, which gives you better encapsulation, is open to fewer side-effects, and could easily contain code to deal with some errors in itself, controlling its response by manipulating a few properties of the error object, and providing a convenient point to distinguish between fatal and recoverable error conditions. You could then point the Error moethod of an object to it, either snagging specific errors to process in the form, passing along the parameters received at the Error method to the generic error handler object in other situations, or bypassing it totally when this is appropriate.

>You might look at Doug Hennig's error handler offering on his web site for a few ideas.

>Create your error object, and in the subclass that you used to create the form (you did subclass the base classes as recommended everywhere), direct the Error method to the default app Error object's handler! Now every form based on this subclass will inherit the default behavior unless you alter it further up the ladder. You could just as easily redirect to a procedure in a common file in your search path; as long as the procedure can be found at runtime, it's there.




I know it doesn't do assignment. :) It was just supposed to be a pseudocode illustration of the effect I was trying to achieve.

That's a good idea for the real error handler. I'll keep this in mind. The thing is that what I was trying to do is turn off the real error handler for a short little snippit and do something different. All this temp error handler needs to do is assign two global variables. I didn't want to make a form-wide method for it just to keep things simple. AERROR() ended up doing the trick, so I'm all set. :)

Thanks,

Michelle
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform