1*f6aab3d8Srobertfrom lldbsuite.support import seven
2*f6aab3d8Srobert
3061da546Spatrickclass BuildError(Exception):
4061da546Spatrick
5061da546Spatrick    def __init__(self, called_process_error):
6061da546Spatrick        super(BuildError, self).__init__("Error when building test subject")
7*f6aab3d8Srobert        self.command = seven.join_for_shell(called_process_error.cmd)
8*f6aab3d8Srobert        self.build_error = called_process_error.output
9061da546Spatrick
10061da546Spatrick    def __str__(self):
11061da546Spatrick        return self.format_build_error(self.command, self.build_error)
12061da546Spatrick
13061da546Spatrick    @staticmethod
14061da546Spatrick    def format_build_error(command, command_output):
15061da546Spatrick        return "Error when building test subject.\n\nBuild Command:\n{}\n\nBuild Command Output:\n{}".format(
16*f6aab3d8Srobert            command, command_output)
17