deepgram.clients.common.v1.errors

 1# Copyright 2023-2024 Deepgram SDK contributors. All Rights Reserved.
 2# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
 3# SPDX-License-Identifier: MIT
 4
 5
 6class DeepgramError(Exception):
 7    """
 8    Exception raised for unknown errors related to the Deepgram API.
 9
10    Attributes:
11        message (str): The error message describing the exception.
12    """
13
14    def __init__(self, message: str):
15        super().__init__(message)
16        self.name = "DeepgramError"
17        self.message = message
18
19    def __str__(self):
20        return f"{self.name}: {self.message}"
21
22
23class DeepgramTypeError(Exception):
24    """
25    Exception raised for unknown errors related to unknown Types for Transcription.
26
27    Attributes:
28        message (str): The error message describing the exception.
29    """
30
31    def __init__(self, message: str):
32        super().__init__(message)
33        self.name = "DeepgramTypeError"
34        self.message = message
35
36    def __str__(self):
37        return f"{self.name}: {self.message}"
38
39
40class DeepgramApiError(Exception):
41    """
42    Exception raised for known errors (in json response format) related to the Deepgram API.
43
44    Attributes:
45        message (str): The error message describing the exception.
46        status (str): The HTTP status associated with the API error.
47        original_error (str - json): The original error that was raised.
48    """
49
50    def __init__(self, message: str, status: str, original_error=None):
51        super().__init__(message)
52        self.name = "DeepgramApiError"
53        self.status = status
54        self.message = message
55        self.original_error = original_error
56
57    def __str__(self):
58        return f"{self.name}: {self.message} (Status: {self.status})"
59
60
61class DeepgramUnknownApiError(DeepgramApiError):
62    """
63    Exception raised for unknown errors related to the Deepgram API.
64
65    Attributes:
66        message (str): The error message describing the exception.
67        status (str): The HTTP status associated with the API error.
68    """
69
70    def __init__(self, message: str, status: str):
71        super().__init__(message, status)
72        self.name = "DeepgramUnknownApiError"
73        self.status = status
74        self.message = message
75
76    def __str__(self):
77        return f"{self.name}: {self.message} (Status: {self.status})"
class DeepgramError(builtins.Exception):
 7class DeepgramError(Exception):
 8    """
 9    Exception raised for unknown errors related to the Deepgram API.
10
11    Attributes:
12        message (str): The error message describing the exception.
13    """
14
15    def __init__(self, message: str):
16        super().__init__(message)
17        self.name = "DeepgramError"
18        self.message = message
19
20    def __str__(self):
21        return f"{self.name}: {self.message}"

Exception raised for unknown errors related to the Deepgram API.

Attributes: message (str): The error message describing the exception.

DeepgramError(message: str)
15    def __init__(self, message: str):
16        super().__init__(message)
17        self.name = "DeepgramError"
18        self.message = message
name
message
class DeepgramTypeError(builtins.Exception):
24class DeepgramTypeError(Exception):
25    """
26    Exception raised for unknown errors related to unknown Types for Transcription.
27
28    Attributes:
29        message (str): The error message describing the exception.
30    """
31
32    def __init__(self, message: str):
33        super().__init__(message)
34        self.name = "DeepgramTypeError"
35        self.message = message
36
37    def __str__(self):
38        return f"{self.name}: {self.message}"

Exception raised for unknown errors related to unknown Types for Transcription.

Attributes: message (str): The error message describing the exception.

DeepgramTypeError(message: str)
32    def __init__(self, message: str):
33        super().__init__(message)
34        self.name = "DeepgramTypeError"
35        self.message = message
name
message
class DeepgramApiError(builtins.Exception):
41class DeepgramApiError(Exception):
42    """
43    Exception raised for known errors (in json response format) related to the Deepgram API.
44
45    Attributes:
46        message (str): The error message describing the exception.
47        status (str): The HTTP status associated with the API error.
48        original_error (str - json): The original error that was raised.
49    """
50
51    def __init__(self, message: str, status: str, original_error=None):
52        super().__init__(message)
53        self.name = "DeepgramApiError"
54        self.status = status
55        self.message = message
56        self.original_error = original_error
57
58    def __str__(self):
59        return f"{self.name}: {self.message} (Status: {self.status})"

Exception raised for known errors (in json response format) related to the Deepgram API.

Attributes: message (str): The error message describing the exception. status (str): The HTTP status associated with the API error. original_error (str - json): The original error that was raised.

DeepgramApiError(message: str, status: str, original_error=None)
51    def __init__(self, message: str, status: str, original_error=None):
52        super().__init__(message)
53        self.name = "DeepgramApiError"
54        self.status = status
55        self.message = message
56        self.original_error = original_error
name
status
message
original_error
class DeepgramUnknownApiError(DeepgramApiError):
62class DeepgramUnknownApiError(DeepgramApiError):
63    """
64    Exception raised for unknown errors related to the Deepgram API.
65
66    Attributes:
67        message (str): The error message describing the exception.
68        status (str): The HTTP status associated with the API error.
69    """
70
71    def __init__(self, message: str, status: str):
72        super().__init__(message, status)
73        self.name = "DeepgramUnknownApiError"
74        self.status = status
75        self.message = message
76
77    def __str__(self):
78        return f"{self.name}: {self.message} (Status: {self.status})"

Exception raised for unknown errors related to the Deepgram API.

Attributes: message (str): The error message describing the exception. status (str): The HTTP status associated with the API error.

DeepgramUnknownApiError(message: str, status: str)
71    def __init__(self, message: str, status: str):
72        super().__init__(message, status)
73        self.name = "DeepgramUnknownApiError"
74        self.status = status
75        self.message = message
name
status
message
Inherited Members
DeepgramApiError
original_error