HomePhabricator

errors: make exit codes class variables instead

Authored by martinvonz.

Description

errors: make exit codes class variables instead

Kyle pointed out to me that we can simply make the exit codes class
variables. Python provides some magic for making them accessible as
instance variables.

This also makes it easier to let subclasses of existing errors
override the exit codes by letting them simply define their own values
as class variables. That means that there's no need to pass them into
the superclass's constructor arguments, so the superclass doesn't need
to expose the them as arguments. (Making a subclass set a different
exit code for a subclass of StorageError was actually the goal with
my recent series.)

Differential Revision: https://phab.mercurial-scm.org/D10758