How to use the azure-devops.azext_devops.devops_sdk.exceptions.AzureDevOpsServiceError function in azure-devops

To help you get started, we’ve selected a few azure-devops examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-devops-cli-extension / azure-devops / azext_devops / devops_sdk / exceptions.py View on Github external
def __init__(self, wrapped_exception):
        self.inner_exception = None
        if wrapped_exception.inner_exception is not None:
            self.inner_exception = AzureDevOpsServiceError(wrapped_exception.inner_exception)
        super(AzureDevOpsServiceError, self).__init__(message=wrapped_exception.message,
                                                      inner_exception=self.inner_exception)
        self.message = wrapped_exception.message
        self.exception_id = wrapped_exception.exception_id
        self.type_name = wrapped_exception.type_name
        self.type_key = wrapped_exception.type_key
        self.error_code = wrapped_exception.error_code
        self.event_id = wrapped_exception.event_id
        self.custom_properties = wrapped_exception.custom_properties
github Azure / azure-devops-cli-extension / azure-devops / azext_devops / devops_sdk / client.py View on Github external
def _handle_error(self, request, response):
        content_type = response.headers.get('Content-Type')
        error_message = ''
        if content_type is None or content_type.find('text/plain') < 0:
            try:
                wrapped_exception = self._base_deserialize('WrappedException', response)
                if wrapped_exception is not None and wrapped_exception.message is not None:
                    raise AzureDevOpsServiceError(wrapped_exception)
                else:
                    # System exceptions from controllers are not returning wrapped exceptions.
                    # Following code is to handle this unusual exception json case.
                    # TODO: dig into this.
                    collection_wrapper = self._base_deserialize('VssJsonCollectionWrapper', response)
                    if collection_wrapper is not None and collection_wrapper.value is not None:
                        wrapped_exception = self._base_deserialize('ImproperException', collection_wrapper.value)
                        if wrapped_exception is not None and wrapped_exception.message is not None:
                            raise AzureDevOpsClientRequestError(wrapped_exception.message)
                # if we get here we still have not raised an exception, try to deserialize as a System Exception
                system_exception = self._base_deserialize('SystemException', response)
                if system_exception is not None and system_exception.message is not None:
                    raise AzureDevOpsClientRequestError(system_exception.message)
            except DeserializationError:
                pass
        elif response.content is not None:
github Azure / azure-devops-cli-extension / azure-devops / azext_devops / devops_sdk / exceptions.py View on Github external
def __init__(self, wrapped_exception):
        self.inner_exception = None
        if wrapped_exception.inner_exception is not None:
            self.inner_exception = AzureDevOpsServiceError(wrapped_exception.inner_exception)
        super(AzureDevOpsServiceError, self).__init__(message=wrapped_exception.message,
                                                      inner_exception=self.inner_exception)
        self.message = wrapped_exception.message
        self.exception_id = wrapped_exception.exception_id
        self.type_name = wrapped_exception.type_name
        self.type_key = wrapped_exception.type_key
        self.error_code = wrapped_exception.error_code
        self.event_id = wrapped_exception.event_id
        self.custom_properties = wrapped_exception.custom_properties

azure-devops

Python wrapper around the Azure DevOps 7.x APIs

MIT
Latest version published 1 year ago

Package Health Score

81 / 100
Full package analysis