From 407579e80b091ad32c100351fe9df77f8b9ba8c4 Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Sun, 25 Feb 2024 17:27:54 -0500 Subject: [PATCH] split repr (exc_type/exc_msg), store more bug data --- ntclient/__init__.py | 3 ++- ntclient/ntsqlite | 2 +- ntclient/services/bugs.py | 30 ++++++++++++++++++++++++------ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ntclient/__init__.py b/ntclient/__init__.py index ed052d1..5242f3f 100644 --- a/ntclient/__init__.py +++ b/ntclient/__init__.py @@ -24,7 +24,8 @@ __copyright__ = "Copyright 2018-2022 Shane Jaroch" __url__ = "https://github.com/nutratech/cli" # Sqlite target versions -__db_target_nt__ = "0.0.6" +# TODO: should this be via versions.csv file? Don't update in two places? +__db_target_nt__ = "0.0.7" __db_target_usda__ = "0.0.9" USDA_XZ_SHA256 = "25dba8428ced42d646bec704981d3a95dc7943240254e884aad37d59eee9616a" diff --git a/ntclient/ntsqlite b/ntclient/ntsqlite index 98564d2..3c83d29 160000 --- a/ntclient/ntsqlite +++ b/ntclient/ntsqlite @@ -1 +1 @@ -Subproject commit 98564d2266bba91698bccbf4ea90c09db314f503 +Subproject commit 3c83d295e4d271ef368775777e19285121d47839 diff --git a/ntclient/services/bugs.py b/ntclient/services/bugs.py index 9315b94..e7d3114 100644 --- a/ntclient/services/bugs.py +++ b/ntclient/services/bugs.py @@ -6,10 +6,12 @@ Created on Tue Feb 13 09:51:48 2024 @author: shane """ import os +import platform import sqlite3 import traceback import ntclient.services.api +from ntclient import __db_target_nt__, __db_target_usda__, __version__ from ntclient.persistence.sql.nt import sql as sql_nt from ntclient.utils import CLI_CONFIG @@ -21,18 +23,34 @@ def insert(args: list, exception: Exception) -> None: sql_nt( """ INSERT INTO bug - (profile_id, arguments, repr, stack, client_info, app_info, user_details) + (profile_id, arguments, exc_type, exc_msg, stack, client_info, app_info, user_details) VALUES - (?,?,?,?,?,?,?) + (?,?,?,?,?,?,?,?) """, ( 1, " ".join(args), - repr(exception), + exception.__class__.__name__, + str(exception), os.linesep.join(traceback.format_tb(exception.__traceback__)), - "client_info", - "app_info", - "user_details", + # client_info + str( + { + "platform": platform.system(), + "python_version": platform.python_version(), + "client_interface": "cli", + } + ), + # app_info + str( + { + "version": __version__, + "version_nt_db_target": __db_target_nt__, + "version_usda_db_target": __db_target_usda__, + } + ), + # user_details + "NOT_IMPLEMENTED", ), ) except sqlite3.IntegrityError as exc: -- 2.52.0