Since the 1st day I’ve been working with Studio I’ve been struggling about how to get infro from an exception other than the String containing the text message of the exception itself. Sometimes, depending on the exception, in traditional languages there may be a certain error code or whatever I can retrieve from the exception and then help me decide what to do. It’s not simply depending always on the kind of exception object. Getting the “StrackTrace”, as well, is of no use, as it seems to consist only on a String containing a log stacktrace text, which is of no use. Having to parse these long texts to try to extract some error code and then act accordingly is unreal, inconsistent, prone to errors and not robust.
For instance, dealing with integration activities involving calls to Microsoft API: sometimes there are asynchronous operations. Not only the activities don’t provide, to my knowledge, a proper way to check the status response code, etc., but also when they fail, an error or exception is thrown. You don’t know if the error is 404 because the operation didn’t complete yet, or another kind of error due to authentication, internet down, or whatever. It’s important to know the error code to see if I should wait, retry, or just abort the operation. Instead, all I get is a several paragraph “human-readable format” long error text, with the exact code somewhere in there.
I’m with you on this topic. There should be some codes for each type of exceptions. but it seems UiPath don’t have any control over it as such because all the exceptions we are initializing in UiPath are derived from programing language VB.Net and C#.
So whatever property and methods these languages provide, are getting inherited in the UiPath studio exception.
I haven’t used the integration service activities myself, but if they are based on GraphApi there’s a chance that the exception or inner exception is a ServiceException (or subtype) in which case it would contain the http status code in the StatusCode property.
Thank you for your suggestion. Unfortunately, the exception is not of that type, as I tried catching it but it simply ignores it.
Also trying to access the “Data” fields from the plain Exception class doesn’t provide any keys related to the code I want to get in this case; there’s only a FaultedDetails object that only provides unuseful information.
The text message from the exception is like this:
[UiPath.IntegrationService.Activities.Runtime.Exceptions.RuntimeException: Request failed with error:
ProviderMessage : error - {code=ResourceNotFound, message=Resource is not found., innerError={date=2024-03-13T13:12:31, request-id=9dfb0c58-6993-46a6-b8c9-b9f6f033e149, client-request-id=9dfb0c58-6993-46a6-b8c9-b9f6f033e149}}
ProviderErrorCode : 404
RequestId : 65f1a63fe4b0601620ab0200
Message : Not Found
Status code: NotFound. Error code: DAP-RT-1101.
at UiPath.IntegrationService.Activities.Runtime.Services.ExecutionService.SendAsync(String requestUri, ExecutionParameters executionParameters, HttpMethod httpMethod, CancellationToken token)
at UiPath.IntegrationService.Activities.Runtime.Services.ExecutionService.ExecuteOperationAsync(ExecutionParameters executionParameters, ConnectorActivityConfiguration activityConfiguration, CancellationToken token)
at UiPath.IntegrationService.Activities.Runtime.Activities.ConnectorActivity.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken token)
at UiPath.IntegrationService.Activities.Runtime.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.IntegrationService.Activities.Runtime.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)]
As usual, lack of information on UiPath side is of no help.