From a0989ccceff19618d970f55165e65dd0b4b45f78 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 7 Feb 2024 16:58:12 +1100 Subject: [PATCH] feat: Add more error catching for plugins This means that people could make completely broken plugins and still have a working wallet --- plugins/example.py | 5 ----- render.py | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/example.py b/plugins/example.py index f9d7c31..a0d2d9d 100644 --- a/plugins/example.py +++ b/plugins/example.py @@ -160,11 +160,6 @@ def dns(params,authentication): def niami(params, authentication): domain = params["domain"] response = requests.get(f"https://api.handshake.niami.io/domain/{domain}") - print(response.text) - if response.status_code != 200: - return {"rating":"Error fetching rating from Niami.io"} - if response.json()["success"] == False: - return {"rating":"Error fetching rating from Niami.io"} data = response.json()["data"] rating = str(data["rating"]["score"]) + " (" + data["rating"]["rarity"] + ")" return {"rating":rating} diff --git a/render.py b/render.py index 98a3ecf..6987dba 100644 --- a/render.py +++ b/render.py @@ -272,6 +272,11 @@ def plugin_output(outputs, returns): html += f'

{returns[returnOutput]["name"]}

' # Get the output + if returnOutput not in outputs: + html += f'

No output

' + html += f'' + html += f'' + continue output = outputs[returnOutput] if returns[returnOutput]["type"] == "list": html += f'