I've got a python script that I run as a standalone and as a gp service in AGS (moving to 10.1 now...). For the standalone execution, I'm throwing a custom exception if there is no data found based on the user's input:
arcpy.MakeTableView_management(lookupTable, luTV, '"COMID"='+gage) if arcpy.GetCount_management(luTV)==0: raise Exception('UnknownIdentifier')
I'm expecting users of the AGS service to be scripting against the REST API, most likely with python, and I want to be able to pass back the same exception through the AGS web service. I have users that plan to hit my service hundreds of times using some kind of iteration--I need a clear way to let them/their code know that a request had a problem.
I'm having trouble finding information on how to I should modify my script. I can see from this question that there will be some differences if the initial request is executed synchronously (somehow directly passed) or submitted as an asynchronous job (use GPResult), although I didn't understand what these differences mean for either the user's or my code.
I'm not seeing what I think I need here, although I probably (definitely) don't understand it all. Don't know if I have to fiddle with the actual configuration of AGS's REST API--I'm really hoping to avoid needing admin privileges.
Is it really as simple as ditching my
raise Exception() syntax and using arcpy.AddMessage() instead?
Thanks for any guidance!