Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to generate an error in calling program
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00699719
Message ID:
00699730
Views:
14
>Hi,
>
>I need to check return values of many API function calls within class. In order to simplify this task I have the following idea: assign a return value to a property of a class and test a value in Assign method for that property.
>
>Define Class test as Custom
>	Protected RetVal
>	Protected Procedure RetVal_Assign(tnRetVal)
>		If tnRetVal != 0
>			Error "Error #" + Trans(tnRetVal)
>		EndIf
>	EndProc
>	Procedure SomeMethod()
>		This.RetVal = SomeAPIFunction()
>	EndProc
>EndDefine
>
>However this code will generate an error within line with Error statement, but I want to generate an error within line where API function is called. Any ideas?
>
>TIA,
>Alexander

>Or approached from the other side
>
>&This.RetVal = SomeAPIFunction()
>
Well, that sure won't work;
&SomeApiFunction()
will be better.
>the return value or filled with "" (hence no command to perform) or the Error command.

Now the return value could be "ReturnValue = SomeValue" which will be performed by the calling function. So, or this assignment is in it, or the Error command is in it. Either way &SomeAPIFunction should give you the result you want (I think). The only thing left is how to pass the SomeValue "back" to the calling function (a second parameter ?).
Previous
Reply
Map
View

Click here to load this message in the networking platform