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 EndDefineHowever 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?