Removing duplication in exceptions