Two questions regarding best practice

hey everyone,

i got 2 questions regarding best practice (i’m preparding for UiPath adv. certificate). i encountered two questions.

  1. if i use the REF and i don’t use queues (and instead i read an excel first). where do i read the data initially? in the init state (in the “first run” sequence) or in the get transaction data state? i can make both work but what’s best practice?

  2. if i use try catch and an exception will be thrown, what log level do i use in the catch block for “exception.source” and “exception.message”?

image

thanks and kind regards!

@muehlbauer157

  1. Both are good enough…depends on preference…Init first run would be best option…as no extra condition is needed for reading the files again in get transactiondata…but few think…as the name suggests get transaction data it is good to dot here…
  2. Both are useful…even exception.stacktrace can be helpful…message gives the messgae and source gives which activity failed and the complete trace till that xaml as well…both has its own use and loglevel will be error if you are rethrowing it or throwing new exception…if you want to handle and continue then warning

Cheers

1 Like
  1. if i use the REF and i don’t use queues (and instead i read an excel first). where do i read the data initially? in the init state (in the “first run” sequence) or in the get transaction data state? i can make both work but what’s best practice?

Answer : In the init state (in the “first run” sequence) you can do that

like reading the excel ,opening the browsers all like this

  1. if i use try catch and an exception will be thrown, what log level do i use in the catch block for “exception.source” and “exception.message”?
  1. Error or Fatal:
  • Use the “Error” log level when an exception represents a critical issue that prevents the workflow from continuing.
  • If the exception source and message indicate a severe problem that you cannot recover from, use the “Error” log level.
  1. Warn or Info:
  • Use the “Warning” or “Info” log level for exceptions that are important but don’t necessarily halt the workflow.
  • If the exception source and message provide useful information for debugging or monitoring the workflow, use the “Warning” or “Info” level.
  • These log levels are typically used for situations that don’t lead to workflow termination but should still be noted.

@muehlbauer157

1 Like

Hi @muehlbauer157 ,
in level of ‘Log message’ → with catch
you can use with here
https://docs.uipath.com/robot/standalone/2023.4/user-guide/logging-and-log-levels#section-log-levels-in-ui-path
regards,

1 Like

1.in init state first run
2.error and exception.message
As for exception handling, when using a Try-Catch block, the log level for logging exception information such as exception.Source and exception.Message would typically be set to “Error.” This ensures that important error details are logged for troubleshooting and monitoring purposes. Logging at the “Error” level indicates that something unexpected has occurred and requires attention.

Hope it helps
Usha

1 Like

thanks for all the quick answers :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.