Downsides of subclassing specific exception in Python? -
I have a situation where a user can provide poor data to get data data that does not exist . At present, when these problems occur then error types are raised or not clear In my API, I intend to make an error to capture in the UI (or I want to give it to the UI Framework Users will be able to run it by reporting directly, which I have tested and works): DataError (ValueError): Increase this error with the message of 'wrong', General ValueErrors Or other exceptions ValueError subclass '' '/ code> and usage: if user_input is not in accept_values: Increase DataError (' bad user_input: {0} '. Format (user_input)) I have no opinion about my approach, and I need an unnecessary code. I know about fluctuation, because I can catch this specific exception without hiding others. But I can not think of any downsides. What happens to this as opposing to just raising my error message with ValueError ? Write a custom exception is almost always th...