fixed typo and throwing exceptions for http error status codes