About Error Handling and Logging - Hyland RPA - Foundation 23.2 - Foundation 23.2 - Ready - Hyland RPA - external

Hyland RPA

Platform
Hyland RPA
Product
Hyland RPA
Release
Foundation 23.2
License

Error Handling

To add error handling to the activity, the method CacheMetadata( CodeActivityMetadata metadata ) must be overridden to add a custom error messages or warnings inside the Composer.

Sample error message

protected override void CacheMetadata(CodeActivityMetadata metadata)
{
   base.CacheMetadata(metadata);if (CalculationString == null)
   metadata.AddValidationError("Argument CalculationString has not been set.");
}

Sample warning message

protected override void CacheMetadata(CodeActivityMetadata metadata)
 {
     base.CacheMetadata(metadata);
     if (CalculationString == null)
     {
         ValidationError validationWarning = new ValidationError("Argument CalculationString has not been set.", true);
         metadata.AddValidationError(validationWarning);
     }
 }

Write Log

To write to logs from your activity, use the class AM.Logging.LogHelper.

Availble log levels

  • LogLevel.Debug

  • LogLevel.Info

  • LogLevel.Warn

  • LogLevel.Error

Example

try
 {
     // Error here
 }
 catch (Exception ex)
 {
     LogHelper.Error(ex.ToString());
     throw;
 }