Throw different exceptions based on error code in response