-
-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathexceptions.py
More file actions
96 lines (63 loc) · 2.15 KB
/
exceptions.py
File metadata and controls
96 lines (63 loc) · 2.15 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
from openapi_core.schema.exceptions import OpenAPIMappingError
import attr
@attr.s
class OpenAPISchemaError(OpenAPIMappingError):
schema = attr.ib()
@attr.s
class NoValidSchema(OpenAPISchemaError):
value = attr.ib()
def __str__(self):
return "No valid schema found for value: {0}".format(self.value)
@attr.s
class UndefinedItemsSchema(OpenAPISchemaError):
type = attr.ib()
def __str__(self):
return "Null value for schema type {0}".format(self.type)
@attr.s
class InvalidSchemaValue(OpenAPISchemaError):
msg = attr.ib()
value = attr.ib()
type = attr.ib()
def __str__(self):
return self.msg.format(value=self.value, type=self.type)
@attr.s
class InvalidCustomFormatSchemaValue(InvalidSchemaValue):
original_exception = attr.ib()
def __str__(self):
return self.msg.format(value=self.value, type=self.type, exception=self.original_exception)
@attr.s
class UndefinedSchemaProperty(OpenAPISchemaError):
extra_props = attr.ib()
def __str__(self):
return "Extra unexpected properties found in schema: {0}".format(self.extra_props)
@attr.s
class InvalidSchemaProperty(OpenAPISchemaError):
property_name = attr.ib()
original_exception = attr.ib()
def __str__(self):
return "Invalid schema property {0}: {1}".format(self.property_name, self.original_exception)
@attr.s
class MissingSchemaProperty(OpenAPISchemaError):
property_name = attr.ib()
def __str__(self):
return "Missing schema property: {0}".format(self.property_name)
@attr.s
class NoOneOfSchema(OpenAPISchemaError):
type = attr.ib()
def __str__(self):
return "Exactly one valid schema type {0} should be valid, None found.".format(self.type)
@attr.s
class MultipleOneOfSchema(OpenAPISchemaError):
type = attr.ib()
def __str__(self):
return "Exactly one schema type {0} should be valid, more than one found".format(self.type)
@attr.s
class InvalidSchema(OpenAPISchemaError):
msg = attr.ib()
def __str__(self):
return self.msg
@attr.s
class InvalidFormat(OpenAPISchemaError):
msg = attr.ib()
def __str__(self):
return self.msg