1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
# Copyright (C) 2018 Linaro Limited
#
# Author: Neil Williams <neil.williams@linaro.org>
#
# This file is part of LAVA.
#
# LAVA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LAVA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along
# with this program; if not, see <http://www.gnu.org/licenses>.
from lava_common.decorators import nottest
class LAVAError(Exception):
""" Base class for all exceptions in LAVA """
error_help = ""
error_type = ""
class InfrastructureError(LAVAError):
"""
Exceptions based on an error raised by a component of the
test which is neither the LAVA dispatcher code nor the
code being executed on the device under test. This includes
errors arising from the device (like the arndale SD controller
issue) and errors arising from the hardware to which the device
is connected (serial console connection, ethernet switches or
internet connection beyond the control of the device under test).
Use LAVABug for errors arising from bugs in LAVA code.
"""
error_help = (
"InfrastructureError: The Infrastructure is not working "
"correctly. Please report this error to LAVA admins."
)
error_type = "Infrastructure"
class ConnectionClosedError(InfrastructureError):
"""
Exception raised when the connection is closed by the remote end
"""
error_help = "ConnectionClosedError: connection closed"
class JobCanceled(LAVAError):
""" The job was canceled """
error_help = "JobCanceled: The job was canceled"
error_type = "Canceled"
class JobError(LAVAError):
"""
An Error arising from the information supplied as part of the TestJob
e.g. HTTP404 on a file to be downloaded as part of the preparation of
the TestJob or a download which results in a file which tar or gzip
does not recognise.
"""
error_help = "JobError: Your job cannot terminate cleanly."
error_type = "Job"
class LAVABug(LAVAError):
"""
An error that is raised when an un-expected error is caught. Only happen
when a bug is encountered.
"""
error_help = "LAVABug: This is probably a bug in LAVA, please report it."
error_type = "Bug"
@nottest
class TestError(LAVAError):
"""
An error in the operation of the test definition, e.g.
in parsing measurements or commands which fail.
Always ensure TestError is caught, logged and cleared. It is not fatal.
"""
error_help = "TestError: A test failed to run, look at the error message."
error_type = "Test"
class ConfigurationError(LAVAError):
error_help = (
"ConfigurationError: The LAVA instance is not configured "
"correctly. Please report this error to LAVA admins."
)
error_type = "Configuration"
class LAVATimeoutError(LAVAError):
error_help = "LAVATimeoutError: test shell has timed out."
error_type = "LAVATimeout"
class MultinodeProtocolTimeoutError(LAVAError):
error_help = (
"MultinodeProtocolTimeoutError: Multinode wait/sync call has timed out."
)
error_type = "MultinodeTimeout"
class LAVAServerError(Exception):
""" Subclass for all exceptions on LAVA server side """
error_help = ""
error_type = ""
class ObjectNotPersisted(LAVAServerError):
error_help = "ObjectNotPersisted: Object is not persisted."
error_type = "ObjectNotPersisted"
class PermissionNameError(LAVAServerError):
error_help = "PermissionNameError: Unexisting permission codename."
error_type = "Unexisting permission codename."
|