MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / _create_error_message

Function _create_error_message

PySimpleGUI/PySimpleGUI.py:22296–22317  ·  view source on GitHub ↗

Creates an error message containing the filename and line number of the users code that made the call into PySimpleGUI :return: Error string to display with file, line number, and line of code :rtype: str

()

Source from the content-addressed store, hash-verified

22294#######################################################################
22295
22296def _create_error_message():
22297 """
22298 Creates an error message containing the filename and line number of the users
22299 code that made the call into PySimpleGUI
22300 :return: Error string to display with file, line number, and line of code
22301 :rtype: str
22302 """
22303
22304 called_func = inspect.stack()[1].function
22305 trace_details = traceback.format_stack()
22306 error_message = ''
22307 file_info_pysimplegui = trace_details[-1].split(",")[0]
22308 for line in reversed(trace_details):
22309 if line.split(",")[0] != file_info_pysimplegui:
22310 error_message = line
22311 break
22312 if error_message != '':
22313 error_parts = error_message.split(', ')
22314 if len(error_parts) < 4:
22315 error_message = error_parts[0] + '\n' + error_parts[1] + '\n' + ''.join(error_parts[2:])
22316 return 'The PySimpleGUI internal reporting function is ' + called_func + '\n' + \
22317 'The error originated from:\n' + error_message
22318
22319
22320# .d8888b. 888 888 d8b

Callers 3

_widget_was_createdMethod · 0.85
_table_clickedMethod · 0.85
_widget_was_createdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected