Fix and add a bit of error handling
Merge pull request #36 from 1j01/api-cli

Fix and add a bit of error handling