@@ -3,8 +3,8 @@ part of flutter_parse_sdk;
3
3
/// ParseException is used in [ParseResult] to inform the user of the exception
4
4
class ParseError {
5
5
ParseError (
6
- {this .code = - 1 ,
7
- this .message = 'Unknown error ' ,
6
+ {this .code = otherCause ,
7
+ this .message = 'OtherCause ' ,
8
8
this .exception,
9
9
bool debug = false }) {
10
10
type = _exceptions[code];
@@ -13,58 +13,279 @@ class ParseError {
13
13
}
14
14
}
15
15
16
+ /// Error code indicating some error other than those enumerated here.
17
+ static const int otherCause = - 1 ;
18
+
19
+ /// Error code indicating that something has gone wrong with the server.
20
+ static const int internalServerError = 1 ;
21
+
22
+ /// Error code indicating the connection to the Parse servers failed.
23
+ static const int connectionFailed = 100 ;
24
+
25
+ /// Error code indicating the specified object doesn't exist.
26
+ static const int objectNotFound = 101 ;
27
+
28
+ /// Error code indicating you tried to query with a datatype that doesn't
29
+ /// support it, like exact matching an array or object.
30
+ static const int invalidQuery = 102 ;
31
+
32
+ /// Error code indicating a missing or invalid classname. Classnames are
33
+ /// case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
34
+ /// only valid characters.
35
+ static const int invalidClassName = 103 ;
36
+
37
+ /// Error code indicating an unspecified object id.
38
+ static const int missingObjectId = 104 ;
39
+
40
+ /// Error code indicating an invalid key name. Keys are case-sensitive. They
41
+ /// must start with a letter, and a-zA-Z0-9_ are the only valid characters.
42
+ static const int invalidKeyName = 105 ;
43
+
44
+ /// Error code indicating a malformed pointer. You should not see this unless
45
+ /// you have been mucking about changing internal Parse code.
46
+ static const int invalidPointer = 106 ;
47
+
48
+ /// Error code indicating that badly formed JSON was received upstream. This
49
+ /// either indicates you have done something unusual with modifying how
50
+ /// things encode to JSON, or the network is failing badly.
51
+ static const int invalidJson = 107 ;
52
+
53
+ /// Error code indicating that the feature you tried to access is only
54
+ /// available internally for testing purposes.
55
+ static const int commandUnavailable = 108 ;
56
+
57
+ /// You must call Parse().initialize before using the Parse library.
58
+ static const int notInitialized = 109 ;
59
+
60
+ /// Error code indicating that a field was set to an inconsistent type.
61
+ static const int incorrectType = 111 ;
62
+
63
+ /// Error code indicating an invalid channel name. A channel name is either
64
+ /// an empty string (the broadcast channel) or contains only a-zA-Z0-9_
65
+ /// characters and starts with a letter.
66
+ static const int invalidChannelName = 112 ;
67
+
68
+ /// Error code indicating that push is misconfigured.
69
+ static const int pushMisconfigured = 115 ;
70
+
71
+ /// Error code indicating that the object is too large.
72
+ static const int objectTooLarge = 116 ;
73
+
74
+ /// Error code indicating that the operation isn't allowed for clients.
75
+ static const int operationForbidden = 119 ;
76
+
77
+ /// Error code indicating the result was not found in the cache.
78
+ static const int cacheMiss = 120 ;
79
+
80
+ /// Error code indicating that an invalid key was used in a nested
81
+ /// JSONObject.
82
+ static const int invalidNestedKey = 121 ;
83
+
84
+ /// Error code indicating that an invalid filename was used for ParseFile.
85
+ /// A valid file name contains only a-zA-Z0-9_. characters and is between 1
86
+ /// and 128 characters.
87
+ static const int invalidFileName = 122 ;
88
+
89
+ /// Error code indicating an invalid ACL was provided.
90
+ static const int invalidAcl = 123 ;
91
+
92
+ /// Error code indicating that the request timed out on the server. Typically
93
+ /// this indicates that the request is too expensive to run.
94
+ static const int timeout = 124 ;
95
+
96
+ /// Error code indicating that the email address was invalid.
97
+ static const int invalidEmailAddress = 125 ;
98
+
99
+ /// Error code indicating a missing content type.
100
+ static const int missingContentType = 126 ;
101
+
102
+ /// Error code indicating a missing content length.
103
+ static const int missingContentLength = 127 ;
104
+
105
+ /// Error code indicating an invalid content length.
106
+ static const int invalidContentLength = 128 ;
107
+
108
+ /// Error code indicating a file that was too large.
109
+ static const int fileTooLarge = 129 ;
110
+
111
+ /// Error code indicating an error saving a file.
112
+ static const int fileSaveError = 130 ;
113
+
114
+ /// Error code indicating that a unique field was given a value that is
115
+ /// already taken.
116
+ static const int duplicateValue = 137 ;
117
+
118
+ /// Error code indicating that a role's name is invalid.
119
+ static const int invalidRoleName = 139 ;
120
+
121
+ /// Error code indicating that an application quota was exceeded. Upgrade to
122
+ /// resolve.
123
+ static const int exceededQuota = 140 ;
124
+
125
+ /// Error code indicating that a Cloud Code script failed.
126
+ static const int scriptFailed = 141 ;
127
+
128
+ /// Error code indicating that a Cloud Code validation failed.
129
+ static const int validationError = 142 ;
130
+
131
+ /// Error code indicating that invalid image data was provided.
132
+ static const int invalidImageData = 143 ;
133
+
134
+ /// Error code indicating an unsaved file.
135
+ static const int unsavedFileError = 151 ;
136
+
137
+ /// Error code indicating an invalid push time.
138
+ static const int invalidPushTimeError = 152 ;
139
+
140
+ /// Error code indicating an error deleting a file.
141
+ static const int fileDeleteError = 153 ;
142
+
143
+ /// Error code indicating an error deleting an unnamed file.
144
+ static const int fileDeleteUnnamedError = 161 ;
145
+
146
+ /// Error code indicating that the application has exceeded its request
147
+ /// limit.
148
+ static const int requestLimitExceeded = 155 ;
149
+
150
+ /// Error code indicating that the request was a duplicate and has been discarded due to
151
+ /// idempotency rules.
152
+ static const int duplicateRequest = 159 ;
153
+
154
+ /// Error code indicating an invalid event name.
155
+ static const int invalidEventName = 160 ;
156
+
157
+ /// Error code indicating that a field had an invalid value.
158
+ static const int invalidValue = 162 ;
159
+
160
+ /// Error code indicating that the username is missing or empty.
161
+ static const int usernameMissing = 200 ;
162
+
163
+ /// Error code indicating that the password is missing or empty.
164
+ static const int passwordMissing = 201 ;
165
+
166
+ /// Error code indicating that the username has already been taken.
167
+ static const int usernameTaken = 202 ;
168
+
169
+ /// Error code indicating that the email has already been taken.
170
+ static const int emailTaken = 203 ;
171
+
172
+ /// Error code indicating that the email is missing, but must be specified.
173
+ static const int emailMissing = 204 ;
174
+
175
+ /// Error code indicating that a user with the specified email was not found.
176
+ static const int emailNotFound = 205 ;
177
+
178
+ /// Error code indicating that a user object without a valid session could
179
+ /// not be altered.
180
+ static const int sessionMissing = 206 ;
181
+
182
+ /// Error code indicating that a user can only be created through signup.
183
+ static const int mustCreateUserThroughSignup = 207 ;
184
+
185
+ /// Error code indicating that an an account being linked is already linked
186
+ /// to another user.
187
+ static const int accountAlreadyLinked = 208 ;
188
+
189
+ /// Error code indicating that the current session token is invalid.
190
+ static const int invalidSessionToken = 209 ;
191
+
192
+ /// Error code indicating an error enabling or verifying MFA
193
+ static const int mfaError = 210 ;
194
+
195
+ /// Error code indicating that a valid MFA token must be provided
196
+ static const int mfaTokenRequired = 211 ;
197
+
198
+ /// Error code indicating that a user cannot be linked to an account because
199
+ /// that account's id could not be found.
200
+ static const int linkedIdMissing = 250 ;
201
+
202
+ /// Error code indicating that a user with a linked (e.g. Facebook) account
203
+ /// has an invalid session.
204
+ static const int invalidLinkedSession = 251 ;
205
+
206
+ /// Error code indicating that a service being linked (e.g. Facebook or
207
+ /// Twitter) is unsupported.
208
+ static const int unsupportedService = 252 ;
209
+
210
+ /// Error code indicating an invalid operation occured on schema
211
+ static const int invalidSchemaOperation = 255 ;
212
+
213
+ /// Error code indicating that there were multiple errors. Aggregate errors
214
+ /// have an "errors" property, which is an array of error objects with more
215
+ /// detail about each error that occurred.
216
+ static const int aggregateError = 600 ;
217
+
218
+ /// Error code indicating the client was unable to read an input file.
219
+ static const int fileReadError = 601 ;
220
+
221
+ /// Error code indicating a real error code is unavailable because
222
+ /// we had to use an XDomainRequest object to allow CORS requests in
223
+ /// Internet Explorer, which strips the body from HTTP responses that have
224
+ /// a non-2XX status code.
225
+ static const int xDomainRequest = 602 ;
226
+
16
227
static const Map <int , String > _exceptions = {
17
- - 1 : 'UnknownError' ,
18
-
19
- // SDK errors / Errors
20
- 1 : 'No Results' ,
21
- 2 : 'OK' ,
22
- 400 : 'Bad Request' ,
23
-
24
- // Parse specific / Exceptions
25
- 100 : 'ConnectionFailed' ,
26
- 101 : 'ObjectNotFound' ,
27
- 102 : 'InvalidQuery' ,
28
- 103 : 'InvalidClassName' ,
29
- 104 : 'MissingObjectId' ,
30
- 105 : 'InvalidKeyName' ,
31
- 106 : 'InvalidPointer' ,
32
- 107 : 'InvalidJson' ,
33
- 108 : 'CommandUnavailable' ,
34
- 109 : 'NotInitialized' ,
35
- 111 : 'IncorrectType' ,
36
- 112 : 'InvalidChannelName' ,
37
- 115 : 'PushMisconfigured' ,
38
- 116 : 'ObjectTooLarge' ,
39
- 119 : 'OperationForbidden' ,
40
- 120 : 'CacheMiss' ,
41
- 121 : 'InvalidNestedKey' ,
42
- 122 : 'InvalidFileName' ,
43
- 123 : 'InvalidAcl' ,
44
- 124 : 'Timeout' ,
45
- 125 : 'InvalidEmailAddress' ,
46
- 135 : 'MissingRequiredFieldError' ,
47
- 137 : 'DuplicateValue' ,
48
- 139 : 'InvalidRoleName' ,
49
- 140 : 'ExceededQuota' ,
50
- 141 : 'ScriptError' ,
51
- 142 : 'ValidationError' ,
52
- 153 : 'FileDeleteError' ,
53
- 155 : 'RequestLimitExceeded' ,
54
- 160 : 'InvalidEventName' ,
55
- 200 : 'UsernameMissing' ,
56
- 201 : 'PasswordMissing' ,
57
- 202 : 'UsernameTaken' ,
58
- 203 : 'EmailTaken' ,
59
- 204 : 'EmailMissing' ,
60
- 205 : 'EmailNotFound' ,
61
- 206 : 'SessionMissing' ,
62
- 207 : 'MustCreateUserThroughSignUp' ,
63
- 208 : 'AccountAlreadyLinked' ,
64
- 209 : 'InvalidSessionToken' ,
65
- 250 : 'LinkedIdMissing' ,
66
- 251 : 'InvalidLinkedSession' ,
67
- 252 : 'UnsupportedService'
228
+ otherCause: 'OtherCause' ,
229
+ internalServerError: 'InternalServerError' ,
230
+ connectionFailed: 'ConnectionFailed' ,
231
+ objectNotFound: 'ObjectNotFound' ,
232
+ invalidQuery: 'InvalidQuery' ,
233
+ invalidClassName: 'InvalidClassName' ,
234
+ missingObjectId: 'MissingObjectId' ,
235
+ invalidKeyName: 'InvalidKeyName' ,
236
+ invalidPointer: 'InvalidPointer' ,
237
+ invalidJson: 'InvalidJson' ,
238
+ commandUnavailable: 'CommandUnavailable' ,
239
+ notInitialized: 'NotInitialized' ,
240
+ incorrectType: 'IncorrectType' ,
241
+ invalidChannelName: 'InvalidChannelName' ,
242
+ pushMisconfigured: 'PushMisconfigured' ,
243
+ objectTooLarge: 'ObjectTooLarge' ,
244
+ operationForbidden: 'OperationForbidden' ,
245
+ cacheMiss: 'CacheMiss' ,
246
+ invalidNestedKey: 'InvalidNestedKey' ,
247
+ invalidFileName: 'InvalidFileName' ,
248
+ invalidAcl: 'InvalidAcl' ,
249
+ timeout: 'Timeout' ,
250
+ invalidEmailAddress: 'InvalidEmailAddress' ,
251
+ missingContentType: 'MissingContentType' ,
252
+ missingContentLength: 'MissingContentLength' ,
253
+ invalidContentLength: 'InvalidContentLength' ,
254
+ fileTooLarge: 'FileTooLarge' ,
255
+ fileSaveError: 'FileSaveError' ,
256
+ duplicateValue: 'DuplicateValue' ,
257
+ invalidRoleName: 'InvalidRoleName' ,
258
+ exceededQuota: 'ExceededQuota' ,
259
+ scriptFailed: 'ScriptError' ,
260
+ validationError: 'ValidationError' ,
261
+ invalidImageData: 'InvalidImageData' ,
262
+ unsavedFileError: 'UnsavedFileError' ,
263
+ invalidPushTimeError: 'InvalidPushTimeError' ,
264
+ fileDeleteError: 'FileDeleteError' ,
265
+ fileDeleteUnnamedError: 'FileDeleteUnnamedError' ,
266
+ requestLimitExceeded: 'RequestLimitExceeded' ,
267
+ duplicateRequest: 'DuplicateRequest' ,
268
+ invalidEventName: 'InvalidEventName' ,
269
+ invalidValue: 'InvalidValue' ,
270
+ usernameMissing: 'UsernameMissing' ,
271
+ passwordMissing: 'PasswordMissing' ,
272
+ usernameTaken: 'UsernameTaken' ,
273
+ emailTaken: 'EmailTaken' ,
274
+ emailMissing: 'EmailMissing' ,
275
+ emailNotFound: 'EmailNotFound' ,
276
+ sessionMissing: 'SessionMissing' ,
277
+ mustCreateUserThroughSignup: 'MustCreateUserThroughSignUp' ,
278
+ accountAlreadyLinked: 'AccountAlreadyLinked' ,
279
+ invalidSessionToken: 'InvalidSessionToken' ,
280
+ mfaError: 'MfaError' ,
281
+ mfaTokenRequired: 'MfaTokenRequired' ,
282
+ linkedIdMissing: 'LinkedIdMissing' ,
283
+ invalidLinkedSession: 'InvalidLinkedSession' ,
284
+ unsupportedService: 'UnsupportedService' ,
285
+ invalidSchemaOperation: 'InvalidSchemaOperation' ,
286
+ aggregateError: 'AggregateError' ,
287
+ fileReadError: 'FileReadError' ,
288
+ xDomainRequest: 'XDomainRequest' ,
68
289
};
69
290
70
291
final int code;
0 commit comments