MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / _get_stack_trace

Function _get_stack_trace

mssqlcli/telemetry.py:230–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

228
229@decorators.suppress_all_exceptions(fallback_return='')
230def _get_stack_trace():
231 def _get_root_path():
232 dir_path = os.path.dirname(os.path.realpath(__file__))
233 head, tail = os.path.split(dir_path)
234 while tail and tail != 'mssql-cli':
235 head, tail = os.path.split(head)
236 return head
237
238 def _remove_root_paths(s):
239 site_package_regex = re.compile('.*\\\\site-packages\\\\')
240
241 root = _get_root_path()
242 frames = [p.replace(root, '') for p in s]
243 return str([site_package_regex.sub('site-packages\\\\', f) for f in frames])
244
245 _, _, ex_traceback = sys.exc_info()
246 trace = traceback.format_tb(ex_traceback)
247 return _remove_cmd_chars(_remove_symbols(_remove_root_paths(trace)))
248
249
250def _remove_cmd_chars(s):

Callers

nothing calls this directly

Calls 3

_remove_cmd_charsFunction · 0.85
_remove_symbolsFunction · 0.85
_remove_root_pathsFunction · 0.85

Tested by

no test coverage detected