Skip to content

devfolorunso/ExceptionHandler

Repository files navigation

Global Exception Handler for UiPath

A custom activity for UiPath that provides global exception handling with OpenAI integration for intelligent error analysis and resolution suggestions.

Features

  • Global exception handling for UiPath workflows
  • Automatic logging of exception details
  • OpenAI-powered analysis of exceptions
  • Suggested fixes based on the exception context
  • Secure API key handling
  • AI-generated email notifications (optional)

Prerequisites

  • UiPath Studio 2022.4 or later
  • .NET Framework 4.7.2 or later
  • OpenAI API key

Installation

  1. Build the solution using Visual Studio
  2. Copy the compiled DLL from the bin\Release folder to your UiPath custom activities folder
  3. Restart UiPath Studio

Usage

  1. In your UiPath workflow, add the "Global Exception Handler" activity

  2. Configure the required inputs:

    • Exception: The exception to handle
    • OpenAI API Key: Your OpenAI API key (store this securely in UiPath's credential manager)
    • Derive Mail Values: Enable this to generate email subject and body (optional)
  3. If Derive Mail Values is enabled, you can use the outputs:

    • Mail Subject: AI-generated subject line for the email
    • Mail Body: AI-generated body containing error details, summary, and suggestions

Example

<Sequence DisplayName="Main Sequence">
    <TryCatch DisplayName="Try Catch">
        <TryCatch.Try>
            <!-- Your workflow activities here -->
        </TryCatch.Try>
        <TryCatch.Catches>
            <Catch x:TypeArguments="s:Exception">
                <Sequence DisplayName="Exception Handler">
                    <GlobalExceptionHandler:GlobalExceptionHandlerActivity 
                        Exception="[exception]" 
                        OpenAIApiKey="[yourOpenAIKey]"
                        DeriveMailValues="[True]"
                        MailSubject="[mailSubject]"
                        MailBody="[mailBody]" />
                </Sequence>
            </Catch>
        </TryCatch.Catches>
    </TryCatch>
</Sequence>

Security Considerations

  • Store your OpenAI API key in UiPath's credential manager
  • Never hardcode the API key in your workflow
  • Review the OpenAI API usage and costs

Support

For issues and feature requests, please create an issue in the repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages