# TypeError: catching classes that do not inherit from BaseException is not allowed

**URL:** <https://discuss.python.org/t/typeerror-catching-classes-that-do-not-inherit-from-baseexception-is-not-allowed/12800>\
**Category:** Python Help\
**Tags:** help\
**Created:** [December 30, 2021, 1:12pm UTC](https://discuss.python.org/t/typeerror-catching-classes-that-do-not-inherit-from-baseexception-is-not-allowed/12800 "2021-12-30T13:12:20Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![aroberge](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/aroberge/32/6200_2.png) [@aroberge](https://discuss.python.org/u/aroberge)\
**Post date:** [December 30, 2021, 8:45pm UTC](https://discuss.python.org/t/typeerror-catching-classes-that-do-not-inherit-from-baseexception-is-not-allowed/12800/6 "2021-12-30T20:45:00Z")

</div>

> [@steven.daprano](#):
>
> It is better to inherit from Exception rather than BaseException  
> directly. Or even from one of the more specialised exception classes.
> 
> The docs say:
> 
> “programmers are encouraged to derive new exceptions from the Exception  
> class or one of its subclasses, and not from BaseException.”

Thanks. I was just using the info from the traceback; I should have search before answering. (And I should probably add this case to friendly-traceback…)

---

_[View the full topic](https://discuss.python.org/t/typeerror-catching-classes-that-do-not-inherit-from-baseexception-is-not-allowed/12800)._
