refactor: rename error classes for consistency and clarity; update related code and tests

This commit is contained in:
bohd4nx
2026-03-15 22:03:32 +02:00
parent 9a090e3dbc
commit 7f269d9a87
17 changed files with 347 additions and 186 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ import base64
from pytoniq_core import Cell
from fragmentapi.types import RequestError
from fragmentapi.types import ParseError
def clean_decode(payload: str) -> str:
@@ -19,7 +19,7 @@ def clean_decode(payload: str) -> str:
Decoded comment string, or ``""`` for an empty payload.
Raises:
RequestError: If the payload cannot be decoded or parsed.
ParseError: If the payload cannot be decoded or parsed.
"""
s = payload.strip()
if not s:
@@ -32,4 +32,4 @@ def clean_decode(payload: str) -> str:
sl.load_uint(32) # op code — always 0 for text comment
return sl.load_snake_string().strip()
except Exception as exc:
raise RequestError(RequestError.UNPARSEABLE.format(context="payload decode", exc=exc)) from exc
raise ParseError(ParseError.UNPARSEABLE.format(context="payload decode", exc=exc)) from exc