I am creating some custom activities using UiPath and I had a couple of questions I could use some help with. Is there a way to use the UiPath log messages in a custom activity created in visual studio? Currently I have tried Console.WriteLine and the NLog package, but both seem to write logs at a “trace” level. I am looking to write logs at an info or error level as well within my custom code.
Secondly, is there a way to do custom error messages? Right now, if my custom component fails, I get an error that says “One or more errors have occurred”. How do I prevent that and created my own error messages? I am trying to make this as readable as possible to my end users. Thank you!
First I would like to understand like how are you currently handling error please ?
Anything you follow…
Errors bubble up to the parent automation the same as any other activity. The issue here isn’t that it’s a custom activity, and there’s nothing that needs to be fixed. This is happening because the error message from the code/activity inside your custom activity isn’t giving a helpful error message. You need to do error handling within your custom activity and then throw useful error messages.
Currently I am throwing my own custom errors, like this one below. Instead of the expected error message displayed, I am getting “One or More errors occurred” in studio:
if (!File.Exists(excelFilePath)) throw new FileNotFoundException("The following Workbook could not be found at the given path: " + excelFilePath);
I am able to post screenshots now.
In my visual studio, I have attached what I have, for example, if a file does not exist.
In my UiPath Studio, you can see that I run the code, get a trace log, but still see “one or more errors occurred”.
I’m sorry, I didn’t realize you’re doing this via VB rather than just a XAML library. Custom libraries created in UiPath Studio are very simple to do. If you could achieve your goal that way I recommend it over VB. Unfortunately, I don’t know much about creating them in VB and won’t be able to help you with this error situation.
@loginerror Hey friend, would you happen to have anyone from your team that may be able to help with custom components created in Visual Studio? Sorry to tag you, but you seem to have a lot of knowledge around the forums