forked from microsoft/semantic-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel_exception.py
More file actions
58 lines (50 loc) · 1.69 KB
/
kernel_exception.py
File metadata and controls
58 lines (50 loc) · 1.69 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
# Copyright (c) Microsoft. All rights reserved.
from enum import Enum
from typing import Optional
class KernelException(Exception):
class ErrorCodes(Enum):
# Unknown error.
UnknownError = -1
# Invalid function description.
InvalidFunctionDescription = 0
# Function overload not supported.
FunctionOverloadNotSupported = 1
# Function not available.
FunctionNotAvailable = 2
# Function type not supported.
FunctionTypeNotSupported = 3
# Invalid function type.
InvalidFunctionType = 4
# Invalid service configuration.
InvalidServiceConfiguration = 5
# Service not found.
ServiceNotFound = 6
# Skill collection not set.
SkillCollectionNotSet = 7
# Represents an error that occurs when invoking a function.
FunctionInvokeError = 8
# Ambiguous implementation.
AmbiguousImplementation = 9
# The error code.
_error_code: ErrorCodes
def __init__(
self,
error_code: ErrorCodes,
message: str,
inner_exception: Optional[Exception] = None,
) -> None:
"""Initializes a new instance of the KernelError class.
Arguments:
error_code {ErrorCodes} -- The error code.
message {str} -- The error message.
inner_exception {Exception} -- The inner exception.
"""
super().__init__(error_code, message, inner_exception)
self._error_code = error_code
@property
def error_code(self) -> ErrorCodes:
"""Gets the error code.
Returns:
ErrorCodes -- The error code.
"""
return self._error_code