Error trapping

I’ve been trying to figure out how to filter some of my lists to check for type errors, or syntax.

 

Is there a way to get Dynamo to throw a flag or popup message with a preprogrammed message to notify a user?

 

We have a pretty massive script running to populate Revit Pipe and Fittings with Shop fab data. The script works if you’re me, and know exactly the inputs off the parts you’re looking for. However, I won’t be the only user running it in our company as it will be standard practice for anything needing takeoff/shop fab spools.

 

I basically want to notify someone if a particular filter character is missing (Mainly a ‘-’ for now, as line number rules are pretty loose.

Or even simply something as simple as, “Line number format incorrect”.

 

You could add IF blocks to check for conditions and insert you error message as one of the inputs.

But depending on what type of “errors” you are trying to catch, you will need to develop a logic for that.

What types of errors do you usually run into? Wrong data type? Missing Parameters?

Example:
TypeErrors: inputs need to be of type Curve. Check type of all elements, and test if == Curve() type.

 

Since you’re already running on top of Revit, you might as well use Revit’s own pop-up message box :

Mainly wrong syntax. Since our line number needs to match a value in the EXCEL file that performs a VLOOKUP, if the values aren’t available right now it just gives a #N/A in Excel. Which isn’t really that bad, it tends so show as a flag when there’s a problem.