Implementing exception handling and email notofications

Hi All

I have a project where i am calling all the sub functionality (Like Login, File download, Logout etc) from Main. The first sequence in the Main is IntialSettings where i am reading the config.xlsx.

So i want to know how should i handle exceptions for the entire project here ? Also there should be a common reusable email component which should email for both Success and Failure cases.

Exceptions: Both known and unknown exceptions.

Keep the whole sequence or flowchart within a TRY block of try catch activity and if the process works fine it will complete every thing in TRY Block it self where atlast inside the try block include a ASSIGN activity like this
bool_error = False

And if the process fails at any point it will go to CATCH block with exception type as System.Exception chosen where use a assign activity like this
bool_error = True

Now in the same TRY CATCH activity we got a block at last named FINAL
Where use a IF activity with condition like this
bool_error = True

And if true it will go to THEN part where we can send a mail for failure status or goes to ELSE Part where we can send mail with success status

Cheers @kkpatel

Yo utilizo la siguiente lógica de manejo de excepciones, en la cual utilizo las maquinas de estado y en cada una de las maquinas tengo Try-Cath, al entrar por algún motivo en el Cath, cargo dos variables (Etapa de error y Detalle de error) las cuales pregunto en cada Transición de las maquinas de estado si estas están o no vacía, en el caso de no estar vacía, es porque ha sucedido una excepción pasando por el Cath del State; posterior a esto entra al State de manejo de excepciones donde tengo un Switch que consulta por la etapa de error ocurrida, cada State es una etapa, y en el caso de ser una excepción no identificada entra al default del Switch; por ultimo cada una de estas acciones del Switch tiene su correo, en el cual utilizo un template de correo al cual le entrego las variables de excepción y así me llega un correo indicando la excepción especifica ocurrida y la etapa donde ha sucedido.

1 Like

@Palaniyappan Awesome, sounds good. Few Questions.

  1. As i said i am calling each sequence from main so the whole main i will put inside Try Block or each individual flow.

  2. How about using Global Exception Handler ?

Main Flow

Yah if it’s just a mail try trigger then we can handle that with simple try catch itself

If we want to handle the exception that occurs and manage them then of course global exception handler is a good option

cheers @kkpatel

@Palaniyappan Also for email is it a good idea to have a common reusable email sequence or at each point just put an email activity with different To, Sub, Body ?

If its a common component then each of the attribute has to be passed through arguments depending upon the different exceptions.

That is always the best option
Because keeping as a separate component in a project will help us to make changes in them at one spot

Cheers @kkpatel

I didn’t get. For not global exception handler option the try block will be in main or for individual Invoke workflow the try will be separate for each.

Try block will be for whole main

Thanks @Palaniyappan

1 Like

I use the following exception handling logic, in which I use the state machines and in each of the machines I have Try-Cath, when entering for some reason in the Cath, I charge two variables (Error stage and Error detail ) which I ask in each Transition of the state machines whether or not they are empty, in the case of not being empty, it is because an exception has happened going through the Cath del State; after this it enters the State of handling of exceptions where I have a Switch that consults for the stage of error occurred, each State is a stage, and in the case of being an unidentified exception it enters the default of the Switch; Finally, each of these actions of the Switch has its mail, in which I use an email template to which I deliver the exception variables and thus I receive an email indicating the specific exception occurred and the stage where it has happened.

1 Like

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