Skip to content

robot.errors

Exceptions and return codes used internally.

External libraries should not used exceptions defined here.

RobotError

RobotError(message='', details='')

Bases: Exception

Base class for Robot Framework errors.

Do not raise this method but use more specific errors instead.

Source code in src/robot/errors.py
def __init__(self, message='', details=''):
    super().__init__(message)
    self.details = details

FrameworkError

FrameworkError(message='', details='')

Bases: RobotError

Can be used when the core framework goes to unexpected state.

It is good to explicitly raise a FrameworkError if some framework component is used incorrectly. This is pretty much same as 'Internal Error' and should of course never happen.

Source code in src/robot/errors.py
def __init__(self, message='', details=''):
    super().__init__(message)
    self.details = details

DataError

DataError(message='', details='', syntax=False)

Bases: RobotError

Used when the provided test data is invalid.

DataErrors are not caught by keywords that run other keywords (e.g. Run Keyword And Expect Error).

Source code in src/robot/errors.py
def __init__(self, message='', details='', syntax=False):
    super().__init__(message, details)
    self.syntax = syntax

VariableError

VariableError(message='', details='')

Bases: DataError

Used when variable does not exist.

VariableErrors are caught by keywords that run other keywords (e.g. Run Keyword And Expect Error).

Source code in src/robot/errors.py
def __init__(self, message='', details=''):
    super().__init__(message, details)

KeywordError

KeywordError(message='', details='')

Bases: DataError

Used when no keyword is found or there is more than one match.

KeywordErrors are caught by keywords that run other keywords (e.g. Run Keyword And Expect Error).

Source code in src/robot/errors.py
def __init__(self, message='', details=''):
    super().__init__(message, details)

TimeoutError

TimeoutError(message='', test_timeout=True)

Bases: RobotError

Used when a test or keyword timeout occurs.

This exception is handled specially so that execution of the current test is always stopped immediately and it is not caught by keywords executing other keywords (e.g. Run Keyword And Expect Error).

Source code in src/robot/errors.py
def __init__(self, message='', test_timeout=True):
    super().__init__(message)
    self.test_timeout = test_timeout

Information

Information(message='', details='')

Bases: RobotError

Used by argument parser with --help or --version.

Source code in src/robot/errors.py
def __init__(self, message='', details=''):
    super().__init__(message)
    self.details = details

ExecutionStatus

ExecutionStatus(
    message,
    test_timeout=False,
    keyword_timeout=False,
    syntax=False,
    exit=False,
    continue_on_failure=False,
    skip=False,
    return_value=None,
)

Bases: RobotError

Base class for exceptions communicating status in test execution.

Source code in src/robot/errors.py
def __init__(self, message, test_timeout=False, keyword_timeout=False,
             syntax=False, exit=False, continue_on_failure=False,
             skip=False, return_value=None):
    if '\r\n' in message:
        message = message.replace('\r\n', '\n')
    from robot.utils import cut_long_message
    super().__init__(cut_long_message(message))
    self.test_timeout = test_timeout
    self.keyword_timeout = keyword_timeout
    self.syntax = syntax
    self.exit = exit
    self._continue_on_failure = continue_on_failure
    self.skip = skip
    self.return_value = return_value

ExecutionFailed

ExecutionFailed(
    message,
    test_timeout=False,
    keyword_timeout=False,
    syntax=False,
    exit=False,
    continue_on_failure=False,
    skip=False,
    return_value=None,
)

Bases: ExecutionStatus

Used for communicating failures in test execution.

Source code in src/robot/errors.py
def __init__(self, message, test_timeout=False, keyword_timeout=False,
             syntax=False, exit=False, continue_on_failure=False,
             skip=False, return_value=None):
    if '\r\n' in message:
        message = message.replace('\r\n', '\n')
    from robot.utils import cut_long_message
    super().__init__(cut_long_message(message))
    self.test_timeout = test_timeout
    self.keyword_timeout = keyword_timeout
    self.syntax = syntax
    self.exit = exit
    self._continue_on_failure = continue_on_failure
    self.skip = skip
    self.return_value = return_value

ExecutionPassed

ExecutionPassed(message=None, **kwargs)

Bases: ExecutionStatus

Base class for all exceptions communicating that execution passed.

Should not be raised directly, but more detailed exceptions used instead.

Source code in src/robot/errors.py
def __init__(self, message=None, **kwargs):
    super().__init__(message, **kwargs)
    self._earlier_failures = []

PassExecution

PassExecution(message)

Bases: ExecutionPassed

Used by 'Pass Execution' keyword.

Source code in src/robot/errors.py
def __init__(self, message):
    super().__init__(message)

ContinueLoop

ContinueLoop()

Bases: ExecutionPassed

Used by CONTINUE statement.

Source code in src/robot/errors.py
def __init__(self):
    super().__init__("Invalid 'CONTINUE' usage.")

BreakLoop

BreakLoop()

Bases: ExecutionPassed

Used by BREAK statement.

Source code in src/robot/errors.py
def __init__(self):
    super().__init__("Invalid 'BREAK' usage.")

ReturnFromKeyword

ReturnFromKeyword(return_value=None, failures=None)

Bases: ExecutionPassed

Used by 'RETURN' statement.

Source code in src/robot/errors.py
def __init__(self, return_value=None, failures=None):
    super().__init__("Invalid 'RETURN' usage.", return_value=return_value)
    if failures:
        self.set_earlier_failures(failures)

RemoteError

1
2
3
RemoteError(
    message="", details="", fatal=False, continuable=False
)

Bases: RobotError

Used by Remote library to report remote errors.

Source code in src/robot/errors.py
def __init__(self, message='', details='', fatal=False, continuable=False):
    super().__init__(message, details)
    self.ROBOT_EXIT_ON_FAILURE = fatal
    self.ROBOT_CONTINUE_ON_FAILURE = continuable