Exception Handling in UiPath | Try Catch Finally full explanation | yellowgreys | YouTube
Aug 14, 2023
Exception Handling in UiPath | Try Catch Finally full explanation | yellowgreys | YouTube
This video provides a full explanation of how to perform exception handling in UiPath, also explains the Try, Catches, and Finally Part. #ExceptionHandling #TryCatch #UipathExceptionHandling ABOUT OUR CHANNEL YellowGrey is the learning destination that helps every individual acquire the skills they need to compete in today’s world. Check out our channel here: / yellowgreys Don’t forget to subscribe! FIND US AT Website: http://www.yellowgreys.com/ GET IN TOUCH Contact us at [email protected] FOLLOW US ON SOCIAL Get updates or reach out to Get updates on our Social Media Profiles! Website: http://www.yellowgreys.com/ Instagram: https://www.instagram.com/yellow_greys/ Facebook: https://www.facebook.com/yellowgreys/ Twitter: https://twitter.com/yellowgreys1 Linkedin: https://linkedin.com/in/yellowgreys
Content
0.359 -> Hello Everyone!
1.359 -> Welcome to yellowgreys in this video,
we will learn about exception handling in
11.059 -> UiPath.
13.429 -> When we develop our projects, there will be
a chance to get an error in any activities
24.23 -> of your workflow right?
27.05 -> That might be a selector exception, argument
exceptions or Null reference exceptions or
33.69 -> system exceptions, and so on.
36.14 -> Now we will learn how to handle such exceptions
in our workflow.
45.239 -> Here I have a workflow, which is already designed
for a demo purpose.
51.38 -> The workflow steps are
the bot will Launch the Browser and open the
58.63 -> amazon home page.
59.86 -> then the bot will search the product name,
here I am searching product name as iPhone
67.32 -> 13.
68.75 -> then click on the search button
then bot going to extract the iPhone product
75.76 -> title, which is available on the first page,
and also the product price.
81.38 -> then the bot will display all the extracted
details.
84.99 -> This is the process we created to show how
to handle exceptions.
93.26 -> this workflow, which is not yet designed to
handle any exceptions.
99.29 -> let me quickly run this workflow to show you,
how it works.
104.32 -> Here the uipath is going to launch the web
browser and it executes whatever the process
112.439 -> steps, we designed.
116.14 -> the workflow ran successfully.
129.289 -> but what if an exception occurs during the
execution of the workflow.
135.93 -> let's say that, for some reason, the browser
crashes during the launch due to an unavailable
146.01 -> internet connection or provides the incorrect
URL of the web page.
152.63 -> or the bot may failure any one of the activities
due to unidentified the right selector.
160.569 -> in such a case what will happen and how you
will handle these scenarios.
166.129 -> In that case, the uipath will throw an exception
and it will terminate the workflow without
176.49 -> executing the further steps.
177.81 -> now, let me quickly run this project one more
time by providing the incorrect URL of the
193.94 -> amazon webpage.
198.94 -> Now, run the workflow.
208.95 -> so here you see, the uipath through an exception,
says that
216.08 -> Source Type Into activity, where the error
occurred
221.129 -> and the message was 'Could not find the UI
element corresponding to this selector '
228.239 -> and exception Type is ' UiPath.Core.SelectorNotFoundException
'
232.769 -> Note this exception, to handle
the workflow.
245.64 -> Now, we come to explain, the exception-handling
part.
249.569 -> Go to the Main workflow.
251.349 -> here drag and drop try-catch activity to handle
the exception.
258.87 -> The activity has three main sections:
263.569 -> Try,
Catches,
266.21 -> and Finally
267.21 -> Try - holds the activity that could throw
an exception;
273.389 -> Catches - specifies the exception type and,
optionally, holds an activity that informs
281.229 -> the user about the found exception;
Finally - holds an activity that should be
287.119 -> executed only if no error occurred or if the
error was already caught.
293.199 -> let's get started with this try block.
298.601 -> this try block holds all the activities which
are thrown to an error.
305.18 -> let me invoke the amazon product search workflow
into Try block.
312.869 -> now in case, any exception occurs inside the
try block.
320.289 -> those exceptions will be handled inside the
catches block.
324.879 -> let's look into the catches block, here we
have the option to add a new catch.
333.43 -> let's click on the exception drop-down, here
we get a list of exceptions.
338.86 -> You can choose the exception type according
to your exception scenario.
344.469 -> now, we know that we may face a selector exception
in our workflow.
353.02 -> Click on the Exception dropdown and select
browser for types.
358.779 -> We already know that what kind of exception
we received while running our workflow.
370.259 -> That is UiPath.Core.SelectorNotFoundException
Search the same exception type here and click
381.43 -> on select then click ok.
388.08 -> We specified the exception type,
392.979 -> what is next?
395.689 -> optionally we can add an activity that informs
the user about the found exception.
402.56 -> I will add a message box activity to show
the output,
410.11 -> inside the message box activity provide exception.message.tostring
to show the exception message.
418.08 -> you can add log messages or email activity
that informs the user about the exception.
430.379 -> and one more thing you can add multiple exceptions
in this catches section.
438.02 -> Let's run the bot again to see the output.
440.939 -> Now, You can see that the bot ran completely
without stopping and it caught the error and
463.009 -> sent a message to the users about the exception.
467.239 -> We have one more section here, that is finally.
473.11 -> This section will be executed when the activity
or set of activities to be performed after
478.979 -> the Try and Catches blocks are executed.
481.189 -> This section is executed only when no exceptions
are thrown or when an error occurs and is
487.259 -> caught in the Catches section.
490.249 -> Consider here, what activity fits here to
handle both the scenario with exception and
498.8 -> without exceptions.
499.8 -> we need to close the browser right?
503.439 -> in both cases.
504.439 -> yes, i will add the close browser workflow
into the finally section to close the browser
514.18 -> in both scenarios.
516.5 -> Let me run the bot with the exception Scenario.
533.97 -> The bot execution happened with exception
and finally the bot executed the close browser
546.93 -> workflow to close the opened browser.
551.43 -> Again, I will run the bot without the exception
Scenario.
589.92 -> The bot executed the entire workflow successfully
and finally the bot executed the close browser
597.92 -> workflow to close the opened browser.
599.56 -> I hope that you find this video useful for
the exception-handling part.
602.67 -> Thank you for Watching!
604.569 -> Connect with us for more tutorials.
Source: https://www.youtube.com/watch?v=AUq28z82GPE