Skip to content

Commit

Permalink
Fail for exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
donmai-me committed Dec 20, 2021
1 parent fa9336e commit 12c7164
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions maiconverter/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import argparse
import re
import traceback
import sys

import maiconverter
from maiconverter.maicrypt import finale_file_encrypt, finale_file_decrypt
Expand Down Expand Up @@ -110,9 +111,9 @@ def chart_convert(args, output):
else:
handle_simai_chart(file, name, output, args)

except Exception as e:
print(f"Error occurred processing {file}. {e}")
traceback.print_exc()
except:
print(f"Error occurred processing {file}.")
raise


def handle_ma2(file, name, output_path, args):
Expand Down Expand Up @@ -207,9 +208,9 @@ def handle_simai_file(file, output_path, args):
out.write(converted.export())
else:
out.write(converted.export(resolution=args.resolution))
except Exception as e:
print(f"Error processing {i + 1} chart of file. {e}")
traceback.print_exc()
except:
print(f"Error processing {i + 1} chart of file.")
raise


def handle_file(input_path, output_dir, command, key):
Expand Down Expand Up @@ -353,12 +354,13 @@ def main():
elif os.path.exists(output_dir) and not os.path.isdir(output_dir):
raise NotADirectoryError(output_dir)

if args.command in ["encrypt", "decrypt"]:
crypto(args, output_dir)
else:
chart_convert(args, output_dir)

print(
"Finished. Join MaiMai Tea Discord server for more info and tools about MaiMai modding!"
)
print("https://discord.gg/WxEMM9dnwR")
try:
if args.command in ["encrypt", "decrypt"]:
crypto(args, output_dir)
else:
chart_convert(args, output_dir)
finally:
print(
"Finished. Join MaiMai Tea Discord server for more info and tools about MaiMai modding!"
)
print("https://discord.gg/WxEMM9dnwR")

0 comments on commit 12c7164

Please sign in to comment.