Print full tracebacks if we have an error

This commit is contained in:
Firepup Sixfifty 2024-06-05 13:11:46 -05:00
parent 994d47a690
commit ae87df72c9
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA

15
main.py
View file

@ -3,6 +3,7 @@ from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler from slack_bolt.adapter.socket_mode import SocketModeHandler
from dotenv import load_dotenv from dotenv import load_dotenv
import firepup650 as fp import firepup650 as fp
from traceback import format_exc
input = fp.replitInput input = fp.replitInput
@ -117,7 +118,9 @@ if __name__ == "__main__":
] ]
ts = found["ts"] ts = found["ts"]
except Exception as E: except Exception as E:
print(f"[WARN] Exception: {E}") print("[WARN] Exception:")
for line in format_exc:
print(f"[WARN] {line}")
break break
else: else:
ts = input("TS ID") ts = input("TS ID")
@ -135,7 +138,10 @@ if __name__ == "__main__":
) )
print("[INFO] Message sent (to the thread)!") print("[INFO] Message sent (to the thread)!")
except Exception as E: except Exception as E:
print(f"[WARN] Exception: {E}") print("[WARN] Exception:")
for line in format_exc:
print(f"[WARN] {line}")
break
except KeyboardInterrupt: except KeyboardInterrupt:
print() print()
if ts: if ts:
@ -147,6 +153,9 @@ if __name__ == "__main__":
client.chat_postMessage(channel=chan, text=msg) client.chat_postMessage(channel=chan, text=msg)
print("[INFO] Message sent (to the channel)!") print("[INFO] Message sent (to the channel)!")
except Exception as E: except Exception as E:
print(f"[WARN] Exception: {E}") print("[WARN] Exception:")
for line in format_exc:
print(f"[WARN] {line}")
break
except KeyboardInterrupt: except KeyboardInterrupt:
print() print()