()
| 228 | |
| 229 | @decorators.suppress_all_exceptions(fallback_return='') |
| 230 | def _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 | |
| 250 | def _remove_cmd_chars(s): |
nothing calls this directly
no test coverage detected