From 9971d6b612c3aa88cff99c35d1e29135be55d8a0 Mon Sep 17 00:00:00 2001 From: naitikrambhia Date: Thu, 26 Sep 2024 19:42:34 -0400 Subject: [PATCH] Depot bug fix --- .gitignore | 3 ++- pros/common/sentry.py | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6fac33e7..5b9ac274 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ out/ *.zip *_pros_capture.png -venv/ +*venv/ +.DS_Store *.pyc diff --git a/pros/common/sentry.py b/pros/common/sentry.py index 6c0c8690..9c7f47bc 100644 --- a/pros/common/sentry.py +++ b/pros/common/sentry.py @@ -1,6 +1,8 @@ from typing import * import click +import os +import sys import pros.common.ui as ui @@ -99,8 +101,16 @@ def restore(self, obj): from sentry_sdk import configure_scope with configure_scope() as scope: - scope.set_extra((key or obj.__class__.__qualname__), jsonpickle.pickler.Pickler(unpicklable=False).flatten(obj)) - + try: + scope.set_extra((key or obj.__class__.__qualname__), jsonpickle.pickler.Pickler(unpicklable=False).flatten(obj)) + except: + if ui.confirm("Malformed depot detected, do you want to reset conductor.pros? This will remove all depots and templates. You will be unable to create a new PROS project if you do not have internet connection."): + file = os.path.join(click.get_app_dir('PROS'), 'conductor.pros') + if os.path.exists(file): + os.remove(file) + ui.echo("Conductor was reset") + sys.exit() + if override_handlers: jsonpickle.handlers.unregister(BaseTemplate)