Improved debugging (#1257)

This commit is contained in:
Colin Delahunty
2022-01-24 12:19:28 -05:00
committed by GitHub
parent 74f028ddb1
commit 291cc7443f
2 changed files with 3 additions and 4 deletions

View File

@@ -4,6 +4,8 @@ import functools
import logging
import os
from gamestonk_terminal.rich_config import console
logger = logging.getLogger(__name__)
@@ -23,6 +25,7 @@ def try_except(f):
try:
return f(*args, **kwargs)
except Exception as e:
console.print(f"[red]Error: {e}[/red]")
logger.exception("%s", type(e).__name__)
return []

View File

@@ -10,7 +10,6 @@ from typing import List
import pytz
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.parent_classes import BaseController
from gamestonk_terminal import feature_flags as gtff
@@ -321,8 +320,6 @@ if __name__ == "__main__":
if "--debug" in sys.argv:
os.environ["DEBUG_MODE"] = "true"
sys.argv.remove("--debug")
else:
os.environ["DEBUG_MODE"] = "false"
if len(sys.argv) > 1 and ".gst" in sys.argv[1]:
if os.path.isfile(sys.argv[1]):
with open(sys.argv[1]) as fp:
@@ -336,5 +333,4 @@ if __name__ == "__main__":
else:
terminal(sys.argv[1:])
else:
os.environ["DEBUG_MODE"] = "false"
terminal()