FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
[WD20] Global Exception Processing
[WD20] Global Exception Processing
Débuté par David Egan, 01 déc. 2015 06:54 - 2 réponses
Connectez-vous…
David Egan
#1
Posté le 01 décembre 2015 - 06:54
Hi
I have a small component in which I want to set my own exception handling, no matter where it occurs. I have therefore put a WHEN EXCEPTION clause in the project initialisation code. For testing purposes I have added ExceptionThrow(1) to one of the global procedures. This throws the exception but I still get the stock standard exception message which in turn kicks me right out of the program which is using the component.
However if I throw the exception within a window procedure (even if I have a separate WHEN EXCEPTION within the window init code) it uses the project exception handling. I'm confused! This seems to be back to front to what the help says & what I would logically expect, (but it suits me for present purposes as I only put exception handling in the window to try & work out what is going on).
I don't know if I'm missing something here but I've always had problems getting general exceptions to work; the scope always seems to be different to what I expect!. Is my understanding wrong, or am I doing something wrong? Most importantly how can I get my project exception clause to work for global procedures?
Thanks
David
Signaler
0
0
Fabrice Harari
#2
Posté le 01 décembre 2015 - 11:52
Hi David,
you are clearly adding a level of complexity with the component.
Did you try to add a second when exception in the MAIN PROJECT init code?
I suspect that the VISIBILITY of the objects of the component MAY have an incidence. So if a coponent window is exposed to the main project, it's part of the main project ad exception are managed there, while a window used internally by the component would be managed from the component init code.
I haven't tested this at all, but it would make sense to me if it worked that way
Best regards
Signaler
0
0
Bruno Caires
#3
Posté le 02 décembre 2015 - 13:46
Hi,
Some considerations:
1) Exceptions are treated hierarchically (first encapsulated code, then Windows defined exception, then project initialization)
2) Regarding to components, there is a slight diference: The project initialization exception treatment of the component is never used (it is used the project initialization of the caller project).
So, I advise you to:
1) Define WHEN... EXCEPTION inside of the global procedure code (if appropriated)
2) Consider that the project initialization exception treatment also fires non treated component exceptions.
Hope it helps,
Bruno
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte