Add custom logger support. Refactor response error handling. Clean code to follow reek style guide.

Using a case statement here clears things nicely up. 
I would suggest using a string comparison instead of a regex. This should have (minimal) performance improvements and makes the matching more akkurate.