fix: Try catch for exceptions

This commit is contained in:
GitBluub
2023-01-05 15:52:55 +09:00
parent 394eaaabcf
commit d9b673bd9b
+3 -3
View File
@@ -115,7 +115,7 @@ class Scorometer():
self.sendEnd(0, {}) self.sendEnd(0, {})
def main(): def main():
#try: try:
start_message = json.loads(input()) start_message = json.loads(input())
if "type" not in start_message.keys() or start_message["type"] != "start" or "name" not in start_message.keys(): if "type" not in start_message.keys() or start_message["type"] != "start" or "name" not in start_message.keys():
print(json.dumps({"error": "Error with the start message"}), flush=True) print(json.dumps({"error": "Error with the start message"}), flush=True)
@@ -125,8 +125,8 @@ def main():
print(json.dumps({"song_launched": song_name}), flush=True) print(json.dumps({"song_launched": song_name}), flush=True)
sc = Scorometer(f"partitions/{song_name}.midi") sc = Scorometer(f"partitions/{song_name}.midi")
sc.gameLoop() sc.gameLoop()
#except Exception as error: except Exception as error:
# print({ "error": error }) print({ "error": error }, flush=True)
if __name__ == "__main__": if __name__ == "__main__":
main() main()