Custom exception classes are super simple to create and make your libraries much easier to work with for your users. For this example we are going to be working with a data api for a social blogging platform called VED.
Built in Exceptions
Our API
import ved
ved.get_articles(user='waylonwalker', per_page=2, page=1)
[
{
"user": "waylonwalker",
"article_id": "49202048",
"title": "My Awesome Article"
}
]
Our First Exception
Custom Base Class
It is common courtesy to create a common base exception for all of your exceptions to derive from. This will give the users of your library more control to handling layers of your ex