Smartsheet SDK exception handling
<p>I am trying to write try except block for smartsheet aPI using python sdk, specially in cases where the API response to call returns error object rather than a usual index result object. Could someone explain what kind of exception would I be catching. I am not sure if I would have to create custom exceptions of my own or whether there are some way to capture exceptions. The API document talks about the error messages, not handling the. Would be great if someone could share some simple examples around the same.</p>

<p>Knowing what a successful response will look like you could try checking for the error response. For example, running a get_row with an invalid rowId will result in this error:</p>

<p><code>
{"requestResponse": null, "result": {"code": 1006, "name": "NotFoundError", "recommendation": "Do not retry without fixing the problem. Hint: Verify that specified URI is correct. If the URI contains an object ID, verify that the object ID is correct and that the requester has access to the corresponding object in Smartsheet.", "shouldRetry": false, "message": "Not Found", "statusCode": 404}}
</code></p>

<p>Seeing requestResponse being null you can check the result object to know what the code is to look up in the Smartsheet API docs. Also, there is a recommendation parameter that gives next steps.</p>

python python-2.7 exception-handling smartsheet-api smartsheet-api-1.1