Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error handling problem - Help!
Message
 
To
12/06/2002 11:37:08
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00667122
Message ID:
00667448
Views:
28
>If the code causing the error is in a form method, yes, I think you have to catch the error in the form error method.

That's just it - the error is being caused by a custom method in the subclassed mscomm object which is an object on the form - so that's where I thought I should trap for the error (yes, I do know the error number).

So what I tried was to put the following into the Error() method of the subclassed MSCOMM object:
LPARAMETERS nError, cMethod, nLine
*~ In THIS.INIT we loop through 10 COM ports, 
*~ attempting to open each with the MSCOMM32.OCX control.
*~ We trap the errors here and if it's an OLE error,
*~ nError will be 1429 (this came from the control).

IF INLIST(nError, 1429, 1426)
*~  Populate an error array and check the OLE message.
	LOCAL aErrArray(1)
	AERROR(aErrArray)
*~ 	If the error msg was "Invalid Port Number"
*~  the control tried to open a port that either
*~  doesn't exist or has nothing on it.
ELSE
*~  We experienced a non - OLE error. Report it.
	mbhError = "Error "+TRANSFORM(nError) + ": "+ SYS(2018)
ENDIF
Please forgive my persistence, but I'd really like to understand this (as well as solve the immediate problem).

TIA
>
>If you know exact error numbers you want to trap, David's solution is simpler.
>
>>Steve:
>>
>>So, I should override the error at the FORM level, rather than down in the object performing the action that caused the error? Is that how error handling in VFP usually works - from the top down? If so, that was the gap in my understanding...
>>
>>TIA
>>Michael
>>
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Previous
Reply
Map
View

Click here to load this message in the networking platform