Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enhanced error handling
#1
 In many RPA software, each Action has an exception handling setting, please see the image below

 There is an err function in QM, but I am very much looking forward to enhancing its functionality and naming it as the new function err2.

 The description of the function is as follows:

 When the error occurs, the code of the line where the error occurred will be Repeat execution, retrying N times, the interval is M seconds, there are three cases:

 Case 1: If the retry is successful, continue to execute downwards. Example code: err2(5 10)

 Case 2: If the retry fails, an error message is displayed, and the following part of the error message shows the line number of the code in which the error occurred (for later searching in the source code)

 Case 3: If the retry fails, execute the function Fun1, then there are two cases:

 A. Continue to execute downwards, sample code: err2(5 10 Fun1 0)
If the retry fails, the error message is displayed, and the error message is the last The line number of the code in which the error occurred

 B. Code to re-execute the line of the error, sample code: err2(5 10 Fun1 1)

Enhanced exception handling is very important, it uses the process to run more stable

The format of the function definition: err2(m n Fun flat)


Macro
err2 Exception handling test
Code:
Copy      Help
MES m.timeout=5; m.style="OCa"; m.default='C'
mes("text" "title" m)

run "$desktop$\test.txt"
err2(5 10)
;err2(5 10 Fun1 1) ;;1 Re-execute the line of code where the error occurred, after executing Fun1
;err2(5 10 Fun1 0) ;;0 After executing Fun1, continue to execute code down
;err2(0 0 Fun1 0) ;;Do not retry, only execute the function Fun1, and then continue to execute downward


Attached Files Image(s)
   
#2
Yes, it can be very useful.
QM2 will not have such updates. Only bug fixes. In QM3 it could look like
 
Code:
Copy      Help
RetryIfFailed(() => Shell.Run("file"), 5, 10);
//or with a function
RetryIfFailed(() => Shell.Run("file"), 5, 10, () => { this is a func });
#3
The above QM3 code seems to be easier to understand, looking forward to QM3, early release Wink


Forum Jump:


Users browsing this thread: 1 Guest(s)