Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSSOAP error trapping 1

Status
Not open for further replies.

dkausa4851

Programmer
Mar 3, 2004
10
US
I'm using MSSOAP in vpf9. I'm calling the GeoCode function with the correct parameters and most of the time all is well. BUT, if the function does not find the address sent, it sends an error back to my program and displays an ulgy system message before I display my message to the user.

GeoCode is supposed to send back a lat/lon in an array, two strings. If it can't find the address, it sends back a false. How can I trap this before it displays its cryptic error message???

Thanks


leArr = oGeo.GeoCode(cStreet, cCity, cState, cZipCode, this.u_sessioncode)

IF TYPE('leArr[1]') = 'L'
lcErrorMsg = "Unable to retrieve Lat/Long co-ordinates "
MESSAGEBOX(lcErrorMsg)
ELSE
this.rlatitude = leArr[1]
this.rlongitude = leArr[2]
this.rReturnCode = "0"
ENDIF
 
You should call the function within a TRY structure:

try
leArr = oGeo.GeoCode(cStreet, cCity, cState, cZipCode, this.u_sessioncode)
* code if it succeeded
catch to loException
* display your own error if it failed
endtry

Doug
 
THANKS Doug, your tip has put a big smile on my face!!

dka
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top