fix: Make namesummary more verbose on errors
All checks were successful
Build Docker / BuildImage (push) Successful in 41s

This commit is contained in:
2025-08-22 20:57:13 +10:00
parent 6f05fe82b8
commit 34348fbf33

View File

@@ -338,8 +338,9 @@ def api_namesummary(name):
"blocksUntilExpire": None,
"owner": None,
"hash": None,
"state": None,
"resources" : []
"state": "CLOSED",
"resources" : [],
"error": None
}
url = f"{HSD_URL()}/"
@@ -360,7 +361,11 @@ def api_namesummary(name):
return jsonify({"error": "Name summary not found"}), 404
name_info = response.json()['result']
if 'info' in name_info:
if 'info' not in name_info or name_info['info'] is None:
summary["error"] = "Name info not found"
return jsonify(summary), 404
summary["hash"] = name_info['info'].get('nameHash', None)
summary["state"] = name_info['info'].get('state', None)
@@ -392,11 +397,11 @@ def api_namesummary(name):
if response.status_code == 200:
# Check if error is null
if 'error' in response.json() and response.json()['error'] is not None:
return jsonify({"error": response.json()['error']}), 400
return jsonify(summary), 200
# Check if result is empty
if 'result' not in response.json() or not response.json()['result']:
return jsonify({"error": "Name resources not found"}), 404
return jsonify(summary), 200
resources = response.json()['result']
if isinstance(resources, list):