Implement the serializer for MolDSException. #31716