Use CastException instead of DomainException and BadMethodCallException