(error_str:str ='')
| 13 | return '' # Return None if no error message is found |
| 14 | |
| 15 | def clean_error_msg(error_str:str =''): |
| 16 | filtered_error_msg = error_str.__str__().split('An error occurred while executing the following cell')[-1].split("\n------------------\n")[-1] |
| 17 | raw_error_msg = "".join(filtered_error_msg) |
| 18 | |
| 19 | # Remove escape sequences for colored text |
| 20 | ansi_escape = re.compile(r'\x1b\[[0-?]*[ -/]*[@-~]') |
| 21 | error_msg = ansi_escape.sub('', raw_error_msg) |
| 22 | |
| 23 | error_str_out = '' |
| 24 | error_msg_only_cell = error_msg.split(SITE_PKG_ERROR_PREFIX) |
| 25 | |
| 26 | error_str_out += f'{error_msg_only_cell[0]}\n' |
| 27 | error_header = get_error_header(error_msg_only_cell[-1]) |
| 28 | if error_header not in error_str_out: |
| 29 | error_str_out += get_error_header(error_msg_only_cell[-1]) |
| 30 | |
| 31 | return error_str_out |
nothing calls this directly
no test coverage detected