@@ -82,13 +82,22 @@ class PlotlyEmptyDataError(PlotlyError):
82
82
# Graph Objects Errors
83
83
class PlotlyGraphObjectError (PlotlyError ):
84
84
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
+ """
85
93
self .message = message
86
94
self .plain_message = message # for backwards compat
87
95
self .path = list (path )
88
96
self .notes = notes
89
97
super (PlotlyGraphObjectError , self ).__init__ (message )
90
98
91
99
def __str__ (self ):
100
+ """This is called by Python to present the error message."""
92
101
format_dict = {
93
102
'message' : self .message ,
94
103
'path' : '[' + '][' .join (repr (k ) for k in self .path ) + ']' ,
@@ -102,6 +111,7 @@ def __str__(self):
102
111
103
112
class PlotlyDictKeyError (PlotlyGraphObjectError ):
104
113
def __init__ (self , obj , path , notes = ()):
114
+ """See PlotlyGraphObjectError.__init__ for param docs."""
105
115
format_dict = {'attribute' : path [- 1 ], 'object_name' : obj ._name }
106
116
message = ("'{attribute}' is not allowed in '{object_name}'"
107
117
.format (** format_dict ))
@@ -113,6 +123,7 @@ def __init__(self, obj, path, notes=()):
113
123
114
124
class PlotlyDictValueError (PlotlyGraphObjectError ):
115
125
def __init__ (self , obj , path , notes = ()):
126
+ """See PlotlyGraphObjectError.__init__ for param docs."""
116
127
format_dict = {'attribute' : path [- 1 ], 'object_name' : obj ._name }
117
128
message = ("'{attribute}' has invalid value inside '{object_name}'"
118
129
.format (** format_dict ))
@@ -124,6 +135,7 @@ def __init__(self, obj, path, notes=()):
124
135
125
136
class PlotlyListEntryError (PlotlyGraphObjectError ):
126
137
def __init__ (self , obj , path , notes = ()):
138
+ """See PlotlyGraphObjectError.__init__ for param docs."""
127
139
format_dict = {'index' : path [- 1 ], 'object_name' : obj ._name }
128
140
message = ("Invalid entry found in '{object_name}' at index, '{index}'"
129
141
.format (** format_dict ))
@@ -135,6 +147,7 @@ def __init__(self, obj, path, notes=()):
135
147
136
148
class PlotlyDataTypeError (PlotlyGraphObjectError ):
137
149
def __init__ (self , obj , path , notes = ()):
150
+ """See PlotlyGraphObjectError.__init__ for param docs."""
138
151
format_dict = {'index' : path [- 1 ], 'object_name' : obj ._name }
139
152
message = ("Invalid entry found in '{object_name}' at index, '{index}'"
140
153
.format (** format_dict ))
0 commit comments