Calling Errors from Library - No Exception Raised?

Hi there, I’m running into a problem where exceptions imported from robot.api.exceptions in my custom library are not actually raising. The keyword passes when it should be throwing an exception

I have put together a small example library and test suite to explain.

From the docstring of exceptions.py:

Exceptions that libraries can use for communicating failures and other events.
These exceptions can be imported also via the top level :mod:robot.api package like from robot.api import SkipExecution.

ErrorTest.py

from robot.api import ContinuableFailure, Failure, Error, FatalError
from robot.api.logger import info, error

class ErrorTest:
    def e_fail(self):
        info('exec Failure()')
        Failure('this should fail')

    def e_cont_fail(self):
        info('exec ContinuableFailure()')
        ContinuableFailure('continuing')

    def e_error(self):
        error('exec Error()')
        Error('some text')
    
    def e_fatal_error(self):
        error('exec FatalError()')
        FatalError('message')

Errors.robot

*** Settings ***
Library             libraries/ErrorTest.py

*** Test Cases ***
Try All Errors
    E Fail
    E Cont Fail
    E Error
    E Fatal Error

Expect Error To Fail
    Run Keyword And Expect Error   *     E Fail

Test Execution Results

$ robot Errors.robot

==============================================================================
Errors
==============================================================================
[ ERROR ] exec Error()
[ ERROR ] exec FatalError()
Try All Errors                                                        | PASS |
------------------------------------------------------------------------------
Expect Error To Fail                                                  | FAIL |
Expected error '*' did not occur.
------------------------------------------------------------------------------
Errors                                                                | FAIL |
2 tests, 1 passed, 1 failed
==============================================================================

Ah, I figured it out, FatalError() et al. are not imported functions but are exceptions, and must be called with raise.

e.g.

def e_error():
        error('exec Error()')
        raise Error('some text')