Skip to content

Commit ee17e91

Browse files
jimmysongclaude
andcommitted
Fix missing f-string prefixes on error messages
Strings with {variable} interpolation were missing the f prefix, causing the literal text "{variable}" to appear in error messages instead of the variable's value. - bcur.py:88 — BCURStringFormatError message - descriptor.py:81,85 — ValueError messages (2 instances) - hd.py:712 — ValueError message - psbt.py:776 — SuspiciousTransaction message Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c0b7d57 commit ee17e91

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

buidl/bcur.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def _parse_bcur_helper(bcur_string):
8585
y_int = int(xofy_parts[1])
8686

8787
if x_int > y_int:
88-
raise BCURStringFormatError("x must be >= y (in x-of-y): {xofy_parts}")
88+
raise BCURStringFormatError(f"x must be >= y (in x-of-y): {xofy_parts}")
8989

9090
else:
9191
raise BCURStringFormatError(f"{string} doesn't have 2-4 slashes")

buidl/descriptor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ def parse_full_key_record(key_record_str):
7878
parts = key_record_str.split("/")
7979
if parts[-1] != "*":
8080
raise ValueError(
81-
"Invalid full key record, does not end with a *: {key_record_str}"
81+
f"Invalid full key record, does not end with a *: {key_record_str}"
8282
)
8383
if not is_intable(parts[-2]):
8484
raise ValueError(
85-
"Invalid full key record, account index `{parts[-2]}` is not an int: {key_record_str}"
85+
f"Invalid full key record, account index `{parts[-2]}` is not an int: {key_record_str}"
8686
)
8787

8888
# Now we strip off the trailing account index and *, and parse the rest as a partial key record

buidl/hd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ def raw_parse(cls, s, network=None):
709709
elif pub_version in ALL_MAINNET_XPUBS:
710710
network = "mainnet"
711711
else:
712-
raise ValueError("not a valid [t-z]pub pub_version: {pub_version}")
712+
raise ValueError(f"not a valid [t-z]pub pub_version: {pub_version}")
713713
# the next byte is depth
714714
depth = byte_to_int(s.read(1))
715715
# next 4 bytes are the parent_fingerprint

buidl/psbt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ def _describe_basic_multisig_inputs(self, hdpubkey_map):
773773

774774
if not root_paths_for_signing:
775775
raise SuspiciousTransaction(
776-
"No `root_paths_for_signing` with `hdpubkey_map` {hdpubkey_map} in PSBT:\n{self}"
776+
f"No `root_paths_for_signing` with `hdpubkey_map` {hdpubkey_map} in PSBT:\n{self}"
777777
)
778778

779779
return {

0 commit comments

Comments
 (0)