File: exceptions.py

package info (click to toggle)
azure-kusto-python 5.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,704 kB
  • sloc: python: 10,633; sh: 13; makefile: 3
file content (45 lines) | stat: -rw-r--r-- 1,621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License
from azure.kusto.data.exceptions import KustoClientError


class KustoMappingError(KustoClientError):
    """
    Raised when the provided mapping arguments are invalid.
    """


class KustoDuplicateMappingError(KustoClientError):
    """
    Raised when ingestion properties include both
    column mappings and a mapping reference
    """

    def __init__(self):
        message = "Ingestion properties can't contain both an explicit mapping and a mapping reference."
        super(KustoDuplicateMappingError, self).__init__(message)


class KustoMissingMappingError(KustoClientError):
    """
    Raised when provided a mapping kind without a mapping reference or column mapping.
    """


class KustoInvalidEndpointError(KustoClientError):
    """Raised when trying to ingest to invalid cluster type."""

    def __init__(self, expected_service_type, actual_service_type, suggested_endpoint_url=None):
        message = f"You are using '{expected_service_type}' client type, but the provided endpoint is of ServiceType '{actual_service_type}'. Initialize the client with the appropriate endpoint URI"
        if suggested_endpoint_url:
            message = message + ": '" + suggested_endpoint_url + "'"
        super(KustoInvalidEndpointError, self).__init__(message)


class KustoQueueError(KustoClientError):

    """Raised when not succeeding to upload message to queue in all retries"""

    def __init__(self):
        message = "Failed to upload message to queues in all reties."
        super(KustoQueueError, self).__init__(message)