Skip to content

Improve error message for Enum with no arguments #934

@mdickinson

Description

@mdickinson

When creating an Enum with no arguments, we get a non-obvious failure message:

>>> class A(HasTraits):
...     foo = Enum()
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in A
  File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_types.py", line 1967, in __init__
    default_value = args[0]
IndexError: tuple index out of range

It would be good to fix the exception type and exception message to something better.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions