|
| So confused about error checking |
| Iniciado por guest, 25,nov. 2017 11:50 - 10 respuestas |
| |
| | | |
|
| |
| Publicado el 25,noviembre 2017 - 11:50 |
For about a year on and off I have been trying to get a global error checking procedure to work. This week I attacked it with a vengeance only to be knocked down again.
In the Global Init of my app I have:
GLOBAL
//General error processing WHEN EXCEPTION ErrorHandling() END
ErrorHandling() is a procedure that sends out an email but it is never called.
My latest test while debugging I get:
ErrorInfo = Duplicates found for key on file.
The Exception code is not called. Why not? What on earth am I doing wrong.
BTW this is an AWP site if that makes any difference.
Many thanks in advance. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 25,noviembre 2017 - 12:14 |
Hi John,
Hyperfile errors have separate error handling, you need HOnError() to control the handling. I use HOnError("*",hErrAll,"") to handle each error individually. Then you need hErrorDuplicates() and hErrorIntegrity() for each hAdd an hModify call.
Kind regards, Piet |
| |
| |
| | | |
|
| | |
| |
| Publicado el 25,noviembre 2017 - 12:23 |
I see. I knew I was missing something fundamental.
Thx
John |
| |
| |
| | | |
|
| | |
| |
| Publicado el 25,noviembre 2017 - 13:07 |
Hi John
to complete the previous answer : EVERYTHING has a normal error handling, managed either with hErrorinfo or ErrorInfo Exceptions are catching crashes, ie error not 'normal'/not managed inside each function.
By example, if you use a fxxx function top manage files on disk, and you try to access an incorrect folder (does not existe, rights problems, etc), you will get an error, managed at the function level (ie the function will return -1, and you need to use errorinfo to manage it.)...
Exceptions are therefore ...the exceptions to the rules, ie errors not managed at the local function level, because nobody ever though this could happen 
As a result, you HAVE to test the result of each function, all the time -AND- use exception to manage the unexpected.
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 25,noviembre 2017 - 16:58 |
Thank you Fabrice. I now understand it.
Thankfully I have a single procedure that assigns a GUID with date/time stamp and allows for Add/Modify or Delete. So when ready to do something with a record I just call the routine with the filename and AM or D and use indirection in the routine. That means I can put the appropriate error checks in there just once.
Incidentally reading the Help on this there is no need to check for anything on HAdd etc. as the automatic error handling does it all.
So in my Init code I have the following which seems to be working when I force an error:
//General error processing WHEN EXCEPTION OnExceptionError() END
//Trap HF and other errors
HOnError("*",hErrLock, "OnLockError") HOnError("*", hErrIntegrity + hErrDuplicates + hErrModify + hErrPassword, "OnOtherError") |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,noviembre 2017 - 14:43 |
Hi John,
>>Incidentally reading the Help on this there is no need to check for anything on HAdd etc. as the automatic error handling does it all.<<
Yeah... I have to completely disagree with you on that one... Here is my take on it :
there is no need to check for anything on HAdd etc. as the automatic error handling does it all -IF AND ONLY IF- you are happy with a geeky set of messages that lets the user scratching his head and does not do all the things YOU need to do the way YOU need it...
And that is just not me 
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 26,noviembre 2017 - 17:16 |
Grr just when I thought I had a handle on it all.
So how exactly is it done? Does this go in the Global Init?
WHEN EXCEPTION OnExceptionError() END
//Trap HF and other errors HOnError("*", hErrAll, "OnGeneralError")
So what do I add after each HAdd, Modify etc?
Back to confusion
Thx |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,noviembre 2017 - 09:32 |
Hi John, you can take a look at our alpha360 project and see how we do it. You can find the Open Source version at: www.alpha360.biz
Regards Steven Sitas |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,noviembre 2017 - 09:38 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,noviembre 2017 - 10:53 |
Hmm Steven and Fabrice. Please don't think I am saying you are wrong as I see your points perfectly.
Having done what Steven does I get exactly the same results using a global trap of errors. I appreciate you get a specific message but even using a Global method you can still get a unique message.
In my case I simply tell the User an error has occurred and either tell them to try again or if it's fatal stop.
In my Program error trap procedure I just check for each individual error code using Case and I can then provide a specific message. However I do not allow the user to interfere in any way (other than trying again) and send the email to me silently.
Thanks for the input all the same but I feel that having error trapping code on every window and procedure is a bit unmanageable.
Thx
John |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,noviembre 2017 - 15:52 |
Hi John, if you have a TRANSACTION in every procedure, like we do, I think you must have error trapping (or error handling) code at the procedure(transaction) level.
Regards Steven Sitas |
| |
| |
| | | |
|
| | | | |
| | |
|