handle errors in management API calls properly

see #118