#3: Implemented method for handling http error codes.