def has_errors(self): if self.geom is None: geom = self.band.asGeometry() else: geom = self.geom errors = geom.validateGeometry() skippable = ["duplicate node", "Geometry has"] othererrors = [] def is_safe(message): for safe in skippable: if safe in message: return True return False # We need to remove errors that are "ok" and not really that bad # We are harder on what is considered valid for polygons. if self.is_polygon_mode: for error in errors: if not is_safe(error.what()): othererrors.append(error) if self.node_count < self.minpoints: error = QgsGeometry.Error("Number of nodes < {0}".format( self.minpoints)) othererrors.append(error) return othererrors