better error handling for curl
Merge pull request #4 from mislav/curl-error

better error handling for curl