hercules-team / python-augeas

Python bindings for Augeas
GNU Lesser General Public License v2.1
44 stars 31 forks source link

Fix error handling in get() and label() #23

Closed pspacek closed 7 years ago

pspacek commented 7 years ago

Errors reported by C library were not detected properly so ValueError was never raised.

thedrow commented 7 years ago

I copy/pasted that logic from the old extension. @lutter Is this correct?

lutter commented 7 years ago

Yes, testing ret < 0 is the right way to test if there's been an error. You can get more detailed error codes by checking aug_error(aug) != AUG_NOERROR (that should only be true if the previous call returned with a negative value)