mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
[nrf52] add better error message for OTA error (#17407)
This commit is contained in:
@@ -5,7 +5,7 @@ import logging
|
||||
from pathlib import Path
|
||||
|
||||
from bleak import BleakScanner
|
||||
from bleak.exc import BleakDeviceNotFoundError
|
||||
from bleak.exc import BleakDBusError, BleakDeviceNotFoundError
|
||||
from smp.exceptions import SMPBadStartDelimiter
|
||||
from smpclient import SMPClient
|
||||
from smpclient.generics import error, success
|
||||
@@ -98,6 +98,12 @@ async def _smpmgr_upload(device: str, firmware: Path) -> None:
|
||||
await smp_client.connect()
|
||||
except BleakDeviceNotFoundError as exc:
|
||||
raise EsphomeError(f"Device {device} not found") from exc
|
||||
except BleakDBusError as exc:
|
||||
if "NotPermitted" in exc.dbus_error:
|
||||
raise EsphomeError(
|
||||
f"Cannot connect to {device}: Make sure the device is paired."
|
||||
) from exc
|
||||
raise EsphomeError(f"BLE error connecting to {device}: {exc}") from exc
|
||||
except SMPBLETransportException as exc:
|
||||
raise EsphomeError(f"Connection error with {device}") from exc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user