Use scoped enums for exceptions instead of a separate class.