Skip to content

Instantly share code, notes, and snippets.

@gashupl
Created April 23, 2019 18:14
Show Gist options
  • Save gashupl/7932eee89b12bfc488f22edb1a167216 to your computer and use it in GitHub Desktop.
Save gashupl/7932eee89b12bfc488f22edb1a167216 to your computer and use it in GitHub Desktop.
try
{
//Validate input and run business logic here…
}
catch (InvalidPluginExecutionException e)
{
throw;
}
catch (CustomIntegrationException e)
{
//Save information about exception in external database
//and queue integration request for the future processing
}
catch (OutOfMemoryException e)
{
throw new InvalidPluginExecutionException(OperationStatus.Failed, e.Message);
}
catch (StackOverflowException e)
{
throw new InvalidPluginExecutionException(OperationStatus.Failed, e.Message);
}
catch (ThreadAbortException e)
{
throw new InvalidPluginExecutionException(OperationStatus.Failed, e.Message);
}
catch (Exception e)
{
tracingService?.Trace($"Plugin failed unexpectedly: '{this.Name}'");
tracingService.Trace($"Exception: {e}");
throw new InvalidPluginExecutionException(OperationStatus.Failed, "Sorry, the action failed unexpectedly!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment