Altering return error code for http errors to return actual error code