From 62d6a7ee49d7255846ce77a88f9409a1aa9dd6e6 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Mon, 14 Apr 2025 21:10:15 -0700 Subject: [PATCH] edit: fail if host not found --- boostedblob/cli.py | 2 ++ boostedblob/request.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/boostedblob/cli.py b/boostedblob/cli.py index 9038c53..e1baf33 100644 --- a/boostedblob/cli.py +++ b/boostedblob/cli.py @@ -353,6 +353,8 @@ async def edit(path: str, read_only: bool = False) -> None: async with bbb.BoostExecutor(DEFAULT_CONCURRENCY) as executor: try: await bbb.copyfile(path_obj, local, executor) + except bbb.request.HostNotFoundError: + raise except FileNotFoundError: print("File not found, creating new file...") with open(local, "w"): diff --git a/boostedblob/request.py b/boostedblob/request.py index 182fb07..2eed89e 100644 --- a/boostedblob/request.py +++ b/boostedblob/request.py @@ -18,6 +18,9 @@ from .xml import dict_to_xml, etree +class HostNotFoundError(FileNotFoundError): ... + + @dataclass(frozen=True) class RawRequest: method: str