Returns status code with exception
exception handling as per @michaelhelmick
Merge pull request #8 from rossdeane/master

Returns status code on exception.