Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Communication]: Added exception to begin_update_phone_number_capabilities #18025

Merged
merged 2 commits into from
Apr 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from typing import TYPE_CHECKING
from azure.core.tracing.decorator import distributed_trace
from azure.core.exceptions import HttpResponseError
from ._generated._phone_numbers_client import PhoneNumbersClient as PhoneNumbersClientGen
from ._generated.models import PhoneNumberSearchRequest
from ._shared.utils import parse_connection_str, get_authentication_policy
Expand Down Expand Up @@ -189,13 +190,19 @@ def begin_update_phone_number_capabilities(
for LRO operations if no Retry-After header is present.
:rtype: ~azure.core.polling.LROPoller[~azure.communication.phonenumbers.models.PurchasedPhoneNumber]
"""
return self._phone_number_client.phone_numbers.begin_update_capabilities(
poller = self._phone_number_client.phone_numbers.begin_update_capabilities(
phone_number,
calling=calling,
sms=sms,
**kwargs
)

result_properties = poller.result().additional_properties
if 'status' in result_properties and result_properties['status'].lower() == 'failed':
raise HttpResponseError(message=result_properties['error']['message'])

return poller

@distributed_trace
def get_purchased_phone_number(
self,
Expand Down