Replicate #168 with failing test
Handle nil http codes from API

Resolves #168
Merge pull request #181 from theodi/bugfix-nil-codes

Fix handling of errors from API where code is nil