traits icon indicating copy to clipboard operation
traits copied to clipboard

Remove 'except Exception' guard from `TraitType.clone`

Open mdickinson opened this issue 1 year ago • 0 comments

[From #1645]

Currently, in most cases TraitType.clone with a new default value tries to validate that default value using self.validate(None, None, default_value). This can fail for trait types like This which need a proper object and name for correct validation, so this code executes inside a try / except Exception wrapper.

Those trait types should override clone to implement their own behaviour, and then we can remove the catch-all-exceptions logic.

mdickinson avatar Aug 10 '22 08:08 mdickinson