Author methane
Recipients Nathaniel Manista, docs@python, methane, rhettinger
Date 2018-08-29.10:20:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1535538013.09.0.56676864532.issue34538@psf.upfronthosting.co.za>
In-reply-to
Content
> Also, it mirrors practices in the standard library  (decimal.DecimalException and sqlite3.DatabaseError).

As Nathaniel said, "it's good idea in the particular circumstances of a particular module's implementation, but generally not."  (I removed "very" because it is too noisy)

For example, socket.error was migrated into OSError.
So not having base exception class for module is also "practices in the standard library".


> For users, it provides a way to catch possible errors that are specific to a particular module.

For tutorial readers, caching errors specific to particular cause should be suggested, instead of particular module.


"How/When custom base exception class is useful" is very high level topic.
It's too difficult for tutorial.

If tutorial reader start using base exception class without any real benefit, it will lead ugly code like this:

  try:
      # some code here
  except ValueError as e:
      raise CustomValueError(e.args)
  except TypeError as e:
      raise CustomTypeError(e.args)
  except ...
History
Date User Action Args
2018-08-29 10:20:13methanesetrecipients: + methane, rhettinger, docs@python, Nathaniel Manista
2018-08-29 10:20:13methanesetmessageid: <1535538013.09.0.56676864532.issue34538@psf.upfronthosting.co.za>
2018-08-29 10:20:13methanelinkissue34538 messages
2018-08-29 10:20:13methanecreate