2

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!

Updates

related posts:

asked Jun 6, 2013 at 0:22
3
  • Not getting so many nibbles here...Maybe another way to phrase this is whether or how python exceptions are propagated by AGS through a web service. Commented Jun 6, 2013 at 22:19
  • beginning to suspect that I should use arcpy.AddMessage/AddError type functionality so that AGS can handle packaging the errors per the client-selected API (REST, SOAP, ...). Commented Jun 7, 2013 at 4:50
  • This doc shows examples of JSON payloads returned via REST, but none include examples of an error. Talked w/ESRI a bit. We looked at returns w/fiddle. Couldn't see anything other than header information and an empty body when an error was raised on the server. He's checking w/some product specialists. While clients of the REST service could check for an empty return string, this would not indicate much about the nature of the error (wouldn't allow a custom error type). Commented Jun 13, 2013 at 22:13

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.