Feature/api error handling

This pull request adds tests for different errors that might come from the server. 

I've focused on the server integration. Tests for invalid json and such will go into issue #12.

I will merge this pull request in some hours if no show stoppers are detected.