Repository: syncthing/syncthing
File: lib/model/model.go (Go)

Code before:
			} else {
				removedPendingFolders = append(removedPendingFolders, map[string]string{
					"folderID": folderID,
				})
			}
			continue
		}
		for deviceID := range pf.OfferedBy {
			if dev, ok := existingDevices[deviceID]; !ok {
				l.Debugf("Discarding pending folder %v from unknown device %v", folderID, deviceID)
				goto removeFolderForDevice
			} else if dev.IgnoredFolder(folderID) {
				l.Debugf("Discarding now ignored pending folder %v for device %v", folderID, deviceID)
				goto removeFolderForDevice
			}
			if folderCfg, ok := existingFolders[folderID]; ok {
				if folderCfg.SharedWith(deviceID) {
					l.Debugf("Discarding now shared pending folder %v for device %v", folderID, deviceID)
					goto removeFolderForDevice
				}
			}
			continue
		removeFolderForDevice:
			if err := m.db.RemovePendingFolderForDevice(folderID, deviceID); err != nil {
				msg := "Failed to remove pending folder-device entry"
				l.Warnf("%v (%v, %v): %v", folderID, deviceID, msg, err)
				m.evLogger.Log(events.Failure, msg)
				continue
			}
			removedPendingFolders = append(removedPendingFolders, map[string]string{
				"folderID": folderID,
				"deviceID": deviceID.String(),
			})
		}
	}
	if len(removedPendingFolders) > 0 {
		m.evLogger.Log(events.PendingFoldersChanged, map[string]interface{}{
			"removed": removedPendingFolders,
		})
	}

	var removedPendingDevices []map[string]string
	pendingDevices, err := m.db.PendingDevices()
	if err != nil {
		msg := "Could not iterate through pending device entries for cleanup"
		l.Warnf("%v: %v", msg, err)
		m.evLogger.Log(events.Failure, msg)
		return
	}
	for deviceID := range pendingDevices {
		if _, ok := ignoredDevices[deviceID]; ok {

Review comment (suggestion):
```suggestion
				l.Warnf("%v (%v, %v): %v", msg, folderID, deviceID, err)
```

Code after:
			} else {
				removedPendingFolders = append(removedPendingFolders, map[string]string{
					"folderID": folderID,
				})
			}
			continue
		}
		for deviceID := range pf.OfferedBy {
			if dev, ok := existingDevices[deviceID]; !ok {
				l.Debugf("Discarding pending folder %v from unknown device %v", folderID, deviceID)
				goto removeFolderForDevice
			} else if dev.IgnoredFolder(folderID) {
				l.Debugf("Discarding now ignored pending folder %v for device %v", folderID, deviceID)
				goto removeFolderForDevice
			}
			if folderCfg, ok := existingFolders[folderID]; ok {
				if folderCfg.SharedWith(deviceID) {
					l.Debugf("Discarding now shared pending folder %v for device %v", folderID, deviceID)
					goto removeFolderForDevice
				}
			}
			continue
		removeFolderForDevice:
			if err := m.db.RemovePendingFolderForDevice(folderID, deviceID); err != nil {
				msg := "Failed to remove pending folder-device entry"
				l.Warnf("%v (%v, %v): %v", msg, folderID, deviceID, err)
				m.evLogger.Log(events.Failure, msg)
				continue
			}
			removedPendingFolders = append(removedPendingFolders, map[string]string{
				"folderID": folderID,
				"deviceID": deviceID.String(),
			})
		}
	}
	if len(removedPendingFolders) > 0 {
		m.evLogger.Log(events.PendingFoldersChanged, map[string]interface{}{
			"removed": removedPendingFolders,
		})
	}

	var removedPendingDevices []map[string]string
	pendingDevices, err := m.db.PendingDevices()
	if err != nil {
		msg := "Could not iterate through pending device entries for cleanup"
		l.Warnf("%v: %v", msg, err)
		m.evLogger.Log(events.Failure, msg)
		return
	}
	for deviceID := range pendingDevices {
		if _, ok := ignoredDevices[deviceID]; ok {