From c64617ee9474d8690df1e395f8454f02a0ddae6c Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Mon, 25 Sep 2017 19:05:12 -0500 Subject: 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. --- docs/index.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'docs') 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 When Mastodon.py encounters an error, it will raise an exception, generally with some text included to tell you what went wrong. +The base class that all mastodon exceptions inherit from is the MastodonError +class. If you are only interested in the fact an error was raised somewhere in +Mastodon.py, and not the details, this is the exception you can catch. + MastodonIllegalArgumentError is generally a programming problem - you asked the API to do something obviously invalid (i.e. specify a privacy scope that does not exist). MastodonFileNotFoundError and MastodonNetworkError are IO errors - could be you -specified a wrong URL, could be the internet is down or your hard drive is dying. +specified a wrong URL, could be the internet is down or your hard drive is +dying. They inherit from MastodonIOError, for easy catching. MastodonAPIError is an error returned from the Mastodon instance - the server has decided it can't fullfill your request (i.e. you requested info on a user that -- cgit v1.2.3