simplify error handling
This commit is contained in:
@@ -196,7 +196,6 @@ def main():
|
||||
print("No saint's day today (or today is a holiday/feast day).")
|
||||
return
|
||||
|
||||
post_errors = []
|
||||
|
||||
for saint in saints:
|
||||
print(f"Saint: {saint['name']}")
|
||||
@@ -219,14 +218,9 @@ def main():
|
||||
print(f" Posted! URL: {status['url']}")
|
||||
except Exception as e:
|
||||
print(f" Error posting: {e}")
|
||||
post_errors.append(str(e))
|
||||
|
||||
raise
|
||||
print()
|
||||
|
||||
if post_errors:
|
||||
print(f"{len(post_errors)} post(s) failed", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user