Created
February 2, 2022 18:08
-
-
Save weiserman/a813508d03b629726e5f2ca66080a0c5 to your computer and use it in GitHub Desktop.
Consumer Robot syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Settings *** | |
Library RPA.Robocorp.WorkItems | |
Library RPA.Tables | |
Library RPA.JSON | |
Library Collections | |
*** Tasks *** | |
Consume Items | |
[Documentation] Cycle through the quote items | |
For Each Input Work Item Handle Quote | |
*** Keywords *** | |
Handle Quote | |
[Documentation] Error handling around one work item | |
${payload}= Get Work Item Payload | |
${Quote Handled}= Run Keyword And Return Status | |
... Action For Item ${payload} | |
IF ${Quote Handled} | |
Release Input Work Item DONE | |
ELSE | |
# Giving a good error message here means that data related errors can be fixed faster in Control Room | |
${error_message}= Set Variable | |
... Failed to handle item for: ${payload}. | |
Log ${error_message} level=ERROR | |
Release Input Work Item FAILED exception_type=BUSINESS message=${error_message} | |
END | |
*** Keywords *** | |
Action For Item | |
[Documentation] | |
... Simulates handling of one work item that fails 1/5 times to highlight BUSINESS exception handling. | |
[Arguments] ${payload} | |
${Item Action OK}= Evaluate random.randint(1, 5) | |
IF ${Item Action OK} != 1 | |
Log Did a thing item for: ${payload} | |
ELSE | |
Fail Failed to handle item for: ${payload}. | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment