1class BuildError(Exception):
2    def __init__(self, called_process_error):
3        super(BuildError, self).__init__("Error when building test subject")
4        self.command = called_process_error.lldb_extensions.get("command", "<command unavailable>")
5        self.build_error = called_process_error.lldb_extensions.get("stderr_content", "<error output unavailable>")
6
7    def __str__(self):
8        return self.format_build_error(self.command, self.build_error)
9
10    @staticmethod
11    def format_build_error(command, command_output):
12        return "Error when building test subject.\n\nBuild Command:\n{}\n\nBuild Command Output:\n{}".format(
13            command,
14            command_output)
15