make with_exception() const work in all cases