Trait-based exception handling