blob: 3e4228385bf45362e5d5a39cfa916e0559525f3a [file] [log] [blame]
Illyoung Choia9d2c2c2019-07-12 13:29:42 -07001#!/usr/bin/env python3
2
3# Copyright 2019-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17"""
18Errors
19"""
20
21
22class ClientError(Exception):
23 """
24 Base class for exceptions in this module.
25 """
26 pass
27
28
29class ClientRPCError(ClientError):
30 """
31 Raised when an RPC call failed.
32
33 Attributes:
34 req_id -- request id
35 message -- explanation of the reason why the RPC call is failed
36 """
37 def __init__(self, req_id, message):
38 self.req_id = req_id
39 self.message = message
40
41
42class ClientInputError(ClientError):
43 """
44 Raised when input parameters are missing or wrong.
45
46 Attributes:
47 message -- explanation of the reason why the RPC call is failed
48 """
49 def __init__(self, message):
50 self.message = message
51
52
53class ClientResponseError(ClientError):
54 """
55 Raised when error is returned
56
57 Attributes:
58 message -- explanation of the reason why the request is failed
59 """
60 def __init__(self, message):
61 self.message = message