xref: /openbsd-src/gnu/llvm/lldb/packages/Python/lldbsuite/test_event/build_exception.py (revision 5a38ef86d0b61900239c7913d24a05e7b88a58f0)
1class BuildError(Exception):
2
3    def __init__(self, called_process_error):
4        super(BuildError, self).__init__("Error when building test subject")
5        self.command = called_process_error.lldb_extensions.get(
6            "command", "<command unavailable>")
7        self.build_error = called_process_error.lldb_extensions["combined_output"]
8
9    def __str__(self):
10        return self.format_build_error(self.command, self.build_error)
11
12    @staticmethod
13    def format_build_error(command, command_output):
14        return "Error when building test subject.\n\nBuild Command:\n{}\n\nBuild Command Output:\n{}".format(
15            command, command_output.decode("utf-8", errors='ignore'))
16