func MongodbIgnoreError()

in nimo-shake/common/error.go [9:43]


func MongodbIgnoreError(err error, op string, isFullSyncStage bool) bool {
	if err == nil {
		return true
	}

	errorCode := mgo.ErrorCodeList(err)
	if err != nil && len(errorCode) == 0 {
		return false
	}

	for _, err := range errorCode {
		switch op {
		case "i":
		case "u":
			if isFullSyncStage {
				if err == 28 { // PathNotViable
					continue
				}
			}
		case "d":
			if err == 26 { // NamespaceNotFound
				continue
			}
		case "c":
			if err == 26 { // NamespaceNotFound
				continue
			}
		default:
			return false
		}
		return false
	}

	return true
}