Meaningful Error Messages through API

Meaningful Error Messages through API

mhillis
Advocate Advocate
848 Views
2 Replies
Message 1 of 3

Meaningful Error Messages through API

mhillis
Advocate
Advocate

Making a post looking for clarification of information.  For context - I have seen this Idea posted but it seems to apply to Revit as a whole rather than being API specific - https://forums.autodesk.com/t5/revit-ideas/meaningful-error-messages/idi-p/6338222

 

On to my point, is there any way to extract more meaningful information from errors through the API?  For example, I'm currently trying to work out an issue with a family I am trying to insert an instance of through the API.  The family is not really unconventional, it's a family that has some nested components.  I'm using a process that has worked well for me in the past.  But, I'm getting the error message shown in the attached screenshot "Cannot make Type".  Fine, I'm familiar with this error, I commonly see it when a value for a parameter I'm entering causes issues within the family, usually being too small since we work with a lot of small elements (aware of Revit's 1/32" rule).  But here's where my frustrations begin. I go through my code as we step and examine each value I'm passing into parameters into the Family and everything seems to line up.  My next step is to insert the family into a project manually and fill out the dimension parameters manually to try and find the offending value/parameter combo. Alas, I put in my values, and it works just fine.  At this point, I'm stuck with a very unhelpful error message. 

 

So the crux of the thread, is there anyway to obtain any meaningful info from this error message (and similar messages)?  Yes, I'm sure I'm missing something in my code, but considering issues like this don't appear until you commit a transaction.  I'm left with no exceptions in my code to guide me or any other info other than "Object can't work!".  So having an error message that was more than just "can't make type' even if just a little more, would go a LONG way. 

0 Likes
849 Views
2 Replies
Replies (2)
Message 2 of 3

Mustafa.Salaheldin
Collaborator
Collaborator

Have you tried "Failure Handlers" and try to get the error message from there?

 


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 3 of 3

jeremytammik
Autodesk
Autodesk

Dear Mhillis,

 

Thank you for your query.

 

The Building Coder suggested a method to debug geometry creation:

 

http://thebuildingcoder.typepad.com/blog/2009/07/debug-geometric-form-creation.html

 

Basically, create model lines instead of solids, then use those model lines manually in the UI to create solids.

 

In general, it always helps enormously to understand what is going on, what you are doing and what might be going wrong if you add some graphical debugging information to your model.

 

The easiest is normally to add 3D model line debugging geometry in all critical places.

 

In general, the UI almost always provides more informative error messages than the API.

 

therefore, I always suggest fully testing and optimising your workflow manually in the UI first, before starting with programming.

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes