INNER CODE UNIT · Python

__get_relevant_part_of_stack_trace

handrew/browserpilot · browserpilot/agents/gpt_selenium_agent.py:265

    def __get_relevant_part_of_stack_trace(self):
        """Get the relevant part of the stack trace."""
        original_stack_trace = traceback.format_exc()
        stack_trace = original_stack_trace.split("\n")[3:5]
        stack_trace = "\n".join(stack_trace)
        # Get the name of this class (GPTSeleniumAgent) and
        # replace it with "env".
        class_name = self.__class__.__name__
        stack_trace = stack_trace.replace(class_name, "env")
        # Get the number after the word "line " in the stack trace.
        everything_after_line = stack_trace.split("line ")[1]
        everything_before_rest = everything_after_line.split(",")[0]
        line_num_str = everything_before_rest.split()[0].strip()
        line_num = int(line_num_str)
        return {"stack_trace": stack_trace, "line_num": line_num}

    def __save_html_snapshot(self):
        """Helpful for debugging."""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…