Feature request: Improve error handling
Closed this issue · 7 comments
I noticed that when restconf panics due to the use of a wrong type for reflection it does not print the name of the field that caused the problem but only the type. I think it could simplify debugging to have access to that information
I will keep posting observations while I build a restconf interface.
For starters, something that was not immediate to me is that ApplyStartupConfig seems to not create [] or maps in the managed object. If a configuration is present for the map/[], I would let ApplyStartupConfig do the creation.
If the map/vector is not created, restconf only reports that there was a nil assignment to map/vector. It would probably simplify the debug process if we always printed the field under examination.
I was playing with your map example (https://freeconf.org/docs/examples/node-list-map/) and if in your go struct you forget one of the fields, restconf tells you that a field is missing but it doesn't tell you where or which one. Now that I played a bit with it I will start reading the documentation seriously. I bet that will clarify many things.
Thank you for the update!
I just pushed an update but instead of changing nodeutil.Reflect I created nodeutil.Node which you should check out. Easier and more powerful to use. It does have better error handling and should give field names.
Docs: https://freeconf.org/docs/examples/node-reflect/
You can reopen this if you still have issues
Thank you! Just in time, I got sidetracked again but I will work again on this project this week!