1cef7893435aa41160dd1255c43cb8498279738ccChris Craik# Copyright 2015 The Chromium Authors. All rights reserved. 2cef7893435aa41160dd1255c43cb8498279738ccChris Craik# Use of this source code is governed by a BSD-style license that can be 3cef7893435aa41160dd1255c43cb8498279738ccChris Craik# found in the LICENSE file. 4cef7893435aa41160dd1255c43cb8498279738ccChris Craik 5cef7893435aa41160dd1255c43cb8498279738ccChris Craik 6cef7893435aa41160dd1255c43cb8498279738ccChris Craikclass BaseError(Exception): 7cef7893435aa41160dd1255c43cb8498279738ccChris Craik """Base error for all test runner errors.""" 8cef7893435aa41160dd1255c43cb8498279738ccChris Craik 9cef7893435aa41160dd1255c43cb8498279738ccChris Craik def __init__(self, message, is_infra_error=False): 10cef7893435aa41160dd1255c43cb8498279738ccChris Craik super(BaseError, self).__init__(message) 11cef7893435aa41160dd1255c43cb8498279738ccChris Craik self._is_infra_error = is_infra_error 12cef7893435aa41160dd1255c43cb8498279738ccChris Craik 1333259e44c8229f70ffe0cf3bb5ca9375c4feb2f9John Reck def __eq__(self, other): 1433259e44c8229f70ffe0cf3bb5ca9375c4feb2f9John Reck return (self.message == other.message 1533259e44c8229f70ffe0cf3bb5ca9375c4feb2f9John Reck and self.is_infra_error == other.is_infra_error) 1633259e44c8229f70ffe0cf3bb5ca9375c4feb2f9John Reck 1733259e44c8229f70ffe0cf3bb5ca9375c4feb2f9John Reck def __ne__(self, other): 1833259e44c8229f70ffe0cf3bb5ca9375c4feb2f9John Reck return not self == other 1933259e44c8229f70ffe0cf3bb5ca9375c4feb2f9John Reck 20cef7893435aa41160dd1255c43cb8498279738ccChris Craik @property 21cef7893435aa41160dd1255c43cb8498279738ccChris Craik def is_infra_error(self): 22cef7893435aa41160dd1255c43cb8498279738ccChris Craik """Property to indicate if error was caused by an infrastructure issue.""" 23cef7893435aa41160dd1255c43cb8498279738ccChris Craik return self._is_infra_error 24cef7893435aa41160dd1255c43cb8498279738ccChris Craik 25