             case AppError.updateCharactertisticNotFound:
                 fallthrough
             case AppError.serviceNotFound:
+                self.peripheral?.disconnect()
                 self.present(UIAlertController.alertOnError(error), animated:true, completion:nil)
             case AppError.invalidState:
                 self.present(UIAlertController.alertWithMessage("Invalid state"), animated: true, completion: nil)

            } else {
                enabledLabel.textColor = UIColor.lightGray
                enabledSwitch.isEnabled = false
                enabledSwitch.isOn = false
            }
        } else {
            statusLabel.text = "Disconnected"

                break
            case PeripheralError.disconnected:
                self.peripheral?.reconnect()
            case PeripheralError.forcedDisconnect:
                break
            default:
                self.present(UIAlertController.alertOnError(error), animated:true, completion:nil)
            }
            self.updateUIStatus()
        }

