Esri / ArcREST

python package for REST API (AGS, AGOL, webmap JSON, etc..)
Apache License 2.0
192 stars 155 forks source link

Include response in any raised exceptions #179

Closed chris-fox closed 8 years ago

chris-fox commented 8 years ago

When raising an exception due to some failure could we include the response in the exception message. This would be helpful in long running scripts where we are logging information to be able to debug failures.

For example in publishItem the response is being printed to the output, but not added in the exception message.

                        if status['status'] == 'failed':
                            #if 'statusMessage' in status:
                                #print( status['statusMessage'])
                            print (str(status))
                            raise Exception("Could not publish item: %s" % itemId)

                        elif status['status'].lower() == "completed":
                            break
                        time.sleep(2)
                return ui
        else:
            print (res)
            raise Exception("Could not publish item: %s" % itemId)
    else:
        print (res)
        raise Exception("Could not publish item: %s" % itemId)
achapkowski commented 8 years ago

@chris-fox I'll take a look at the LOE for this. Thank you

achapkowski commented 8 years ago

@chis-fox - we have added it to the TODO list. Sorry no ETA when this will finish.