Add more descriptive error for lawn mower link print error. - gopher-lawn - The… | |
git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhf… | |
Log | |
Files | |
Refs | |
Tags | |
--- | |
commit c3a8dd8aabb09e4148787a9b5ceeebb288b8e3fb | |
parent 2b1d818d03dbd3099e6b9cc9ca552bc20676d9dd | |
Author: Christoph Lohmann <[email protected]> | |
Date: Sat, 29 Jul 2023 15:35:08 +0200 | |
Add more descriptive error for lawn mower link print error. | |
Diffstat: | |
M lawn-mower/lawn-mower.py | 17 +++++++++++------ | |
1 file changed, 11 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/lawn-mower/lawn-mower.py b/lawn-mower/lawn-mower.py | |
@@ -210,12 +210,17 @@ def main(args): | |
return rtext | |
def printlink(link): | |
- rtext = "[%s|%s|%s|%s|%s]\n" \ | |
- % (linktype2gopher(link),\ | |
- link["linkname"],\ | |
- link["selector"],\ | |
- link["host"],\ | |
- link["port"]) | |
+ try: | |
+ rtext = "[%s|%s|%s|%s|%s]\n" \ | |
+ % (linktype2gopher(link),\ | |
+ link["linkname"],\ | |
+ link["selector"],\ | |
+ link["host"],\ | |
+ link["port"]) | |
+ except KeyError: | |
+ print("Error printing link in: %s" % (link)) | |
+ return "" | |
+ | |
if "description" in link: | |
rtext += printdescription(link["description"]) | |
rtext += "\n" |