Informative Error Handling - Dynamo Player

I have recently deployed a number of dynamo scripts to my team to utilize the last couple of months. After getting feedback from the team, one thing seems to be fairly common in requests - better error handling within Dynamo player. While the errors that pop-up for me in Dynamo, the errors that come out of Dynamo Player can be very vague and don’t currently do a good job of informing team members where to look for issues with the inputs given. For example, one my scripts looks for text on a specific layer to then apply attributes to blocks. If that text is not on the layer that was defined in the inputs, it can bring up a ton of warnings that may not seem related to the retrieval of text in the graph. More complex graphs with multiple inputs can make it challenging for them to handle errors on their own without diving into the full Dynamo environment, which I am reluctant to show right now.

Has anyone had any success is providing better error messages to team members for common issues that have/could pop-up?

@achintya_bhat :backhand_index_pointing_up:

1 Like

Informative handling for known isn’t too bad for the errors you can see users likely running into. Basically can write a quick ‘check’ periodically along the graph right before where you expect the error to occur, and then if a known failing condition occurs return an informative error message, otherwise return an empty list. Join all the checks into one list with a List.Join, and pass that into a watch node renamed to ‘error messages’ which has been marked as an output.

As an example, say the graph needs to get a point on a surface given a U and V parameter. You could check for U and V values using something like this (typing on my phone so pardon any typos):

messages = [“U input is too low. Select a value between 0 and 1.”, “U value is too high. Select a value between 0 and 1.”, “ V input is too low. Select a value between 0 and 1.”, “v value is too high. Select a value between 0 and 1.”, []];

uIndex = uInput <0 ? 0: uInput>1 ? 1: 4;
vIndex = vInput <0 ? 2: vInput>1 ? 3: 4;

errorMessages = messages[List.Join([uIndex, vIndex])];

@jbrunkhorst something else that you may or may not be aware of…

If you right-click on a Watch node and set it to Is Output, then its contents will be displayed in the “Outputs” area in Dynamo Player. So you can create conditional messages like Jacob demonstrated above and output them to the user that way.

Example here:

1 Like

Thank you all for the input! I have been sidetracked from this effort for a bit, but these are all solid recommendations and should help me achieve what I am looking for!