Curl error handling

Closes #27