Robotic Process Automation (RPA)

Robotic Process Automation (RPA)

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  Error handling command X Error window

    Posted Fri July 09, 2021 04:08 PM
    Edited by Stephanie Wilkerson Tue July 13, 2021 01:46 PM
    Hi all!

    I just ran this simple script for error handling tests and according to IBM the error window shouldn´t had popped, due to the fact
    that the "onError --label subManipular_Erro" command is located at the begining of code and also - recover command - was
    provided inside the error handling sub-routine, making sure that the error was treated and exempting the need for error window.

    So, why this error window popped ? Please kindly check the code below for you analysis.

    defVar --name varResultado --type Numeric
    defVar --name varData_Hora_Atuais --type DateTime
    onError --label subManipular_Erro
    evaluate --expression "10/0" varResultado=value
    logMessage --message "${varResultado}" --type "Info"
    beginSub --name subManipular_Erro
        getCurrentDateAndTime --localorutc "LocalTime" varData_Hora_Atuais=value
        logMessage --message "------------------------------------------------------------\r\nData e hora do erro: ${varData_Hora_Atuais}\r\nMensagem do erro: ${wdg:error.Message}\r\nLinha do erro: ${wdg:error.LineNumber}\r\nComando: ${wdg:error.Command}\r\nScript do erro: ${wdg:error.Script}\r\nRotina do erro: ${wdg:error.Routine}" --type "Info"
        recover
    endSub


    Cordial Regards,


    ------------------------------
    Mauro Sérgio
    ------------------------------


  • 2.  RE: Error handling command X Error window

    Posted Mon July 12, 2021 12:49 PM
    Hi Mauro,

    Error handling only works if you are not debugging.  Try running without debugging (Ctrl + F5).  It works!

    ------------------------------
    NIGEL CROWTHER
    ------------------------------



  • 3.  RE: Error handling command X Error window

    Posted Mon July 12, 2021 03:56 PM
    Hi Nigel,

    It´s working now, CTRL + F5 solved it.

    Thank you very much,
    Regards,

    ------------------------------
    Mauro Sérgio
    ------------------------------



  • 4.  RE: Error handling command X Error window

    Posted Tue July 13, 2021 12:58 PM
    That's not it. 
    By design, when debugging the Studio will always show the error for you, regardless if there is a handle error command. But, you can continue the execution (press Continue button or F5) and the Studio will resume the execution, and since there is a "handle error" command in place, it will resume the execution without error.

    ------------------------------
    Joba Diniz
    Product Manager
    IBM
    ------------------------------



  • 5.  RE: Error handling command X Error window

    Posted Tue July 13, 2021 07:12 PM
    If you start running without debugging, it works.
    Thanks.

    ------------------------------
    Mauro Sérgio
    ------------------------------