Skip to content

Commit

Permalink
Merge pull request #39 from digitalocean/request-error-example
Browse files Browse the repository at this point in the history
Fixes #28 - Adds example to docs for RequestError
  • Loading branch information
Zach Moody authored Feb 28, 2018
2 parents e427621 + ffd8836 commit c153faa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pynetbox/lib/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ class RequestError(Exception):
More detailed exception that returns the requests object. Along
with some attributes with specific details from the requests
object.
:Example:
>>> try:
... nb.dcim.devices.create({'name': 'destined-for-failure'})
... except pynetbox.RequestError as e:
... print(e.error)
...
{"device_role":["This field is required."]}
"""
def __init__(self, message):
req = message
Expand Down

0 comments on commit c153faa

Please sign in to comment.