Source code for airtest.core.error

# -*- coding: utf-8 -*-

"""
error classes
"""

[docs]class BaseError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value)
[docs]class AirtestError(BaseError): """ This is Airtest BaseError """ pass
[docs]class InvalidMatchingMethodError(BaseError): """ This is InvalidMatchingMethodError BaseError When an invalid matching method is used in settings. """ pass
[docs]class TargetNotFoundError(AirtestError): """ This is TargetNotFoundError BaseError When something is not found """ pass
[docs]class ScriptParamError(AirtestError): """ This is ScriptParamError BaseError When something goes wrong """ pass
[docs]class AdbError(Exception): """ This is AdbError BaseError When ADB have something wrong """ def __init__(self, stdout, stderr): self.stdout = stdout self.stderr = stderr def __str__(self): return "stdout[%s] stderr[%s]" % (self.stdout, self.stderr)
[docs]class AdbShellError(AdbError): """ adb shell error """ pass
[docs]class DeviceConnectionError(BaseError): """ device connection error """ DEVICE_CONNECTION_ERROR = r"error:\s*((device \'\S+\' not found)|(cannot connect to daemon at [\w\:\s\.]+ Connection timed out))" pass
[docs]class ICmdError(Exception): """ This is ICmdError BaseError When ICmd have something wrong """ def __init__(self, stdout, stderr): self.stdout = stdout self.stderr = stderr def __str__(self): return "stdout[%s] stderr[%s]" %(self.stdout, self.stderr)
[docs]class MinicapError(BaseError): """ This is MinicapError BaseError When Minicap have something wrong """ pass
[docs]class MinitouchError(BaseError): """ This is MinitouchError BaseError When Minicap have something wrong """ pass
[docs]class PerformanceError(BaseError): pass