8000 Add some minimal :dolls:. · ii0/plotly.py@a06b116 · GitHub
[go: up one dir, main page]

Skip to content

Commit a06b116

Browse files
committed
Add some minimal 🎎.
1 parent f11cd54 commit a06b116

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

plotly/exceptions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,22 @@ class PlotlyEmptyDataError(PlotlyError):
8282
# Graph Objects Errors
8383
class PlotlyGraphObjectError(PlotlyError):
8484
def __init__(self, message='', path=(), notes=()):
85+
"""
86+
General graph object error for validation failures.
87+
88+
:param (str|unicode) message: The error message.
89+
:param (iterable) path: A path pointing to the error.
90+
:param notes: Add additional notes, but keep default exception message.
91+
92+
"""
8593
self.message = message
8694
self.plain_message = message # for backwards compat
8795
self.path = list(path)
8896
self.notes = notes
8997
super(PlotlyGraphObjectError, self).__init__(message)
9098

9199
def __str__(self):
100+
"""This is called by Python to present the error message."""
92101
format_dict = {
93102
'message': self.message,
94103
'path': '[' + ']['.join(repr(k) for k in self.path) + ']',
@@ -102,6 +111,7 @@ def __str__(self):
102111

103112
class PlotlyDictKeyError(PlotlyGraphObjectError):
104113
def __init__(self, obj, path, notes=()):
114+
"""See PlotlyGraphObjectError.__init__ for param docs."""
105115
format_dict = {'attribute': path[-1], 'object_name': obj._name}
106116
message = ("'{attribute}' is not allowed in '{object_name}'"
107117
.format(**format_dict))
@@ -113,6 +123,7 @@ def __init__(self, obj, path, notes=()):
113123

114124
class PlotlyDictValueError(PlotlyGraphObjectError):
115125
def __init__(self, obj, path, notes=()):
126+
"""See PlotlyGraphObjectError.__init__ for param docs."""
116127
format_dict = {'attribute': path[-1], 'object_name': obj._name}
117128
message = ("'{attribute}' has invalid value inside '{object_name}'"
118129
.format(**format_dict))
@@ -124,6 +135,7 @@ def __init__(self, obj, path, notes=()):
124135

125136
class PlotlyListEntryError(PlotlyGraphObjectError):
126137
def __init__(self, obj, path, notes=()):
138+
"""See PlotlyGraphObjectError.__init__ for param docs."""
127139
format_dict = {'index': path[-1], 'object_name': obj._name}
128140
message = ("Invalid entry found in '{object_name}' at index, '{index}'"
129141
.format(**format_dict))
@@ -135,6 +147,7 @@ def __init__(self, obj, path, notes=()):
135147

136148
class PlotlyDataTypeError(PlotlyGraphObjectError):
137149
def __init__(self, obj, path, notes=()):
150+
"""See PlotlyGraphObjectError.__init__ for param docs."""
138151
format_dict = {'index': path[-1], 'object_name': obj._name}
139152
message = ("Invalid entry found in '{object_name}' at index, '{index}'"
140153
.format(**format_dict))

0 commit comments

Comments
 (0)
0