Custom exception


When Jatin sir did same, it showed exceptions must derive from BaseException but when I did the same thing, it showed AttributeError: ‘TypeError’ object has no attribute ‘message’.
What would be the reason for this?

hey @Mohit2000 ,
The reason is that you haven’t inherited your custom class from Excpetion . Just do that , and it will work.

I know this but what I am saying that when Jatin sir did the same mistake, it threw some another error. Please, carefully read my question

hey @Mohit2000,
If you have a look at the video Python - Error Handling 3 at 4:45 , you will see that sir has only printed e not e.message.
Whereas you are doing the second one. and hence getting an error.