fix error 500
This commit is contained in:
@@ -95,7 +95,7 @@ def _address(address: str | None) -> str | None:
|
|||||||
@app.get("/", include_in_schema=False)
|
@app.get("/", include_in_schema=False)
|
||||||
async def root():
|
async def root():
|
||||||
"""Redirect root to interactive API docs."""
|
"""Redirect root to interactive API docs."""
|
||||||
return RedirectResponse(url="/docs")
|
return RedirectResponse(url="docs")
|
||||||
|
|
||||||
|
|
||||||
@app.get(
|
@app.get(
|
||||||
|
|||||||
@@ -162,6 +162,16 @@ class RFCOMMClient:
|
|||||||
loop.sock_connect(sock, (self._address, self._channel)),
|
loop.sock_connect(sock, (self._address, self._channel)),
|
||||||
timeout=10.0,
|
timeout=10.0,
|
||||||
)
|
)
|
||||||
|
except asyncio.TimeoutError as exc:
|
||||||
|
sock.close()
|
||||||
|
raise PrinterTimeout(
|
||||||
|
f"Classic Bluetooth connection timed out to {self._address} (channel {self._channel})."
|
||||||
|
) from exc
|
||||||
|
except OSError as exc:
|
||||||
|
sock.close()
|
||||||
|
raise PrinterError(
|
||||||
|
f"Classic Bluetooth connection failed for '{self._address}' (channel {self._channel}): {exc}"
|
||||||
|
) from exc
|
||||||
except Exception:
|
except Exception:
|
||||||
sock.close()
|
sock.close()
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ ingress: true
|
|||||||
ingress_port: 8765
|
ingress_port: 8765
|
||||||
panel_icon: mdi:printer
|
panel_icon: mdi:printer
|
||||||
panel_title: Fichero Printer
|
panel_title: Fichero Printer
|
||||||
webui: "http://[HOST]:[PORT:8765]/docs"
|
webui: "http://[HOST]:[PORT:8765]/"
|
||||||
|
|
||||||
host_network: true
|
host_network: true
|
||||||
host_dbus: true
|
host_dbus: true
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ def _address(address: str | None) -> str | None:
|
|||||||
@app.get("/", include_in_schema=False)
|
@app.get("/", include_in_schema=False)
|
||||||
async def root():
|
async def root():
|
||||||
"""Redirect root to interactive API docs."""
|
"""Redirect root to interactive API docs."""
|
||||||
return RedirectResponse(url="/docs")
|
return RedirectResponse(url="docs")
|
||||||
|
|
||||||
|
|
||||||
@app.get(
|
@app.get(
|
||||||
|
|||||||
@@ -162,6 +162,16 @@ class RFCOMMClient:
|
|||||||
loop.sock_connect(sock, (self._address, self._channel)),
|
loop.sock_connect(sock, (self._address, self._channel)),
|
||||||
timeout=10.0,
|
timeout=10.0,
|
||||||
)
|
)
|
||||||
|
except asyncio.TimeoutError as exc:
|
||||||
|
sock.close()
|
||||||
|
raise PrinterTimeout(
|
||||||
|
f"Classic Bluetooth connection timed out to {self._address} (channel {self._channel})."
|
||||||
|
) from exc
|
||||||
|
except OSError as exc:
|
||||||
|
sock.close()
|
||||||
|
raise PrinterError(
|
||||||
|
f"Classic Bluetooth connection failed for '{self._address}' (channel {self._channel}): {exc}"
|
||||||
|
) from exc
|
||||||
except Exception:
|
except Exception:
|
||||||
sock.close()
|
sock.close()
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user