ContinuableFailure terminate the procee when occore error

Robot Framework 7.3.1 (Python 3.10.12 on linux)

from robot.api import ContinuableFailure
from robot.api.deco import keyword

class con:
    def __init(slef):
        pass

    def example_keyword(self):
        if True:
            raise ContinuableFailure('Something is wrong but execution can continue.')
        
        log("continue")

I’m trying to use ContinuableFailure in a custom python keyword, but any steps after raising the failure aren’t executed.

Hello,

Thanks to share your framework

raising ContinuableFailure does not mean the rest of the Python method will execute. If you want to log or perform actions after a continuable failure, you need to restructure your code like this:

from robot.api import ContinuableFailure
from robot.api.deco import keyword
from robot.api import logger

class con:
@keyword
def example_keyword(self):
try:
if True:
raise ContinuableFailure(‘Something is wrong but execution can continue.’)
except ContinuableFailure as cf:
logger.warn(str(cf))
# log warning and continue; don’t re-raise here
logger.info(“continue”)

Best Regard,
Angela

Hi @angela852black,

Thanks for your reply; I realize I’ve misunderstood the documentation for a while. I’ll try your code ASAP