NebulaGraph Python Client 5.3.0
Loading...
Searching...
No Matches
error.py
1# Copyright 2025 vesoft-inc
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15from typing import TYPE_CHECKING, Optional
16
17from nebulagraph_python._error_code import ErrorCode
18
19if TYPE_CHECKING:
20 from nebulagraph_python.result_set import ResultSet
21
22
23class NebulaGraphRemoteError(Exception):
24 code: ErrorCode
25 message: str
26 result: Optional["ResultSet"]
27
28 def __init__(
29 self, code: ErrorCode, message: str, result: Optional["ResultSet"] = None
30 ):
31 self.codecode = code
32 self.messagemessage = message
33 self.resultresult = result
34 super().__init__(f"{code.value}: {message}")
35
36
37class NebulaGraphClientError(Exception):
38 pass
39
40
41class InternalError(NebulaGraphClientError):
42 """General internal error that cannot be recovered due to unexpected inputs or bugs"""
43
44 pass
45
46
48 """Error raised when connecting to the server"""
49
50 pass
51
52
53class AuthenticatingError(NebulaGraphClientError):
54 """Error raised when authenticating failed"""
55
56 pass
57
58
59class ExecutingError(NebulaGraphClientError):
60 """Error raised when executing a statement failed"""
61
62 pass
63
64
65class PoolError(NebulaGraphClientError):
66 """Error raised when pool is not healthy"""
67
68 pass