max_line_length = 79
-[{COMMIT_EDITMSG,MERGE_MSG,SQUASH_MSG,git-rebase-todo}]
+[{COMMIT_EDITMSG,MERGE_MSG,SQUASH_MSG,TAG_EDITMSG,git-rebase-todo}]
max_line_length = 72
__version__,
)
from ntclient.argparser import build_subcommands
-from ntclient.utils import CLI_CONFIG
+from ntclient.utils import CLI_CONFIG, handle_runtime_exception
from ntclient.utils.exceptions import SqlException
exit_code, *_results = func(_parser)
except SqlException as sql_exception: # pragma: no cover
print("Issue with an sqlite database: " + repr(sql_exception))
- if CLI_CONFIG.debug:
- raise
+ handle_runtime_exception(sql_exception)
except HTTPError as http_error: # pragma: no cover
err_msg = "{0}: {1}".format(http_error.code, repr(http_error))
print("Server response error, try again: " + err_msg)
- if CLI_CONFIG.debug:
- raise
+ handle_runtime_exception(http_error)
except URLError as url_error: # pragma: no cover
print("Connection error, check your internet: " + repr(url_error.reason))
- if CLI_CONFIG.debug:
- raise
+ handle_runtime_exception(url_error)
except Exception as exception: # pylint: disable=broad-except # pragma: no cover
print("Unforeseen error, run with --debug for more info: " + repr(exception))
print("You can open an issue here: %s" % __url__)
print("Or send me an email with the debug output: %s" % __email__)
- if CLI_CONFIG.debug:
- raise
+ handle_runtime_exception(exception)
finally:
if CLI_CONFIG.debug:
exc_time = time.time() - start_time
build_day_subcommand(subparsers)
build_recipe_subcommand(subparsers)
build_calc_subcommand(subparsers)
+ build_subcommand_bug(subparsers)
################################################################################
"ankle", type=float, nargs="?", help="ankle (cm) [casey_butt]"
)
calc_lbl_parser.set_defaults(func=parser_funcs.calc_lbm_limits)
+
+
+def build_subcommand_bug(subparsers: argparse._SubParsersAction) -> None:
+ """Report bugs"""
+
+ bug_parser = subparsers.add_parser("bug", help="report bugs")
+ bug_parser.set_defaults(func=parser_funcs.bugs_report)
print(_table)
return 0, result
+
+
+def bugs_report() -> tuple:
+ """Report a bug"""
+ n_submissions = ntclient.services.bugs.submit()
+ return 0, n_submissions
-Subproject commit e69368ff9a64db7134a212686c08922c6537bcee
+Subproject commit 939f55077b97bd1fe1c8e2b897b032dbc1564487
--- /dev/null
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Feb 13 09:51:48 2024
+
+@author: shane
+"""
raise ValueError( # pragma: no cover
"No such ActivityFactor for value: %s" % activity_factor
)
+
+
+def handle_runtime_exception(exception: Exception) -> None:
+ """
+ Handles exceptions raised during runtime.
+ """
+ print("Exception: %s" % exception)
+ if CLI_CONFIG.debug:
+ raise exception