diff options
author | Elizabeth Myers <[email protected]> | 2017-09-25 19:05:12 -0500 |
---|---|---|
committer | Elizabeth Myers <[email protected]> | 2017-09-25 19:11:16 -0500 |
commit | c64617ee9474d8690df1e395f8454f02a0ddae6c (patch) | |
tree | 390cfd966da48c08dae404889180303be5f93429 /docs | |
parent | 6ab283d17e1eac2b521bbaffc1b0a635fd68c9f5 (diff) | |
download | mastodon.py-c64617ee9474d8690df1e395f8454f02a0ddae6c.tar.gz |
Redesign exception hierarchy
All Mastodon.py errors now derive from MastodonError, for easier
catching in application code that just wants to see if something
happened, and isn't too miffed about the details.
I/O Errors derive from MastodonIOError, for similar reasons.
This change is designed to be backwards compatible.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.rst | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/index.rst b/docs/index.rst index 11b655a..fae8b2d 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -112,12 +112,17 @@ Error handling | |||
112 | When Mastodon.py encounters an error, it will raise an exception, generally with | 112 | When Mastodon.py encounters an error, it will raise an exception, generally with |
113 | some text included to tell you what went wrong. | 113 | some text included to tell you what went wrong. |
114 | 114 | ||
115 | The base class that all mastodon exceptions inherit from is the MastodonError | ||
116 | class. If you are only interested in the fact an error was raised somewhere in | ||
117 | Mastodon.py, and not the details, this is the exception you can catch. | ||
118 | |||
115 | MastodonIllegalArgumentError is generally a programming problem - you asked the | 119 | MastodonIllegalArgumentError is generally a programming problem - you asked the |
116 | API to do something obviously invalid (i.e. specify a privacy scope that does | 120 | API to do something obviously invalid (i.e. specify a privacy scope that does |
117 | not exist). | 121 | not exist). |
118 | 122 | ||
119 | MastodonFileNotFoundError and MastodonNetworkError are IO errors - could be you | 123 | MastodonFileNotFoundError and MastodonNetworkError are IO errors - could be you |
120 | specified a wrong URL, could be the internet is down or your hard drive is dying. | 124 | specified a wrong URL, could be the internet is down or your hard drive is |
125 | dying. They inherit from MastodonIOError, for easy catching. | ||
121 | 126 | ||
122 | MastodonAPIError is an error returned from the Mastodon instance - the server | 127 | MastodonAPIError is an error returned from the Mastodon instance - the server |
123 | has decided it can't fullfill your request (i.e. you requested info on a user that | 128 | has decided it can't fullfill your request (i.e. you requested info on a user that |