Skip to content

Commit c1f26b2

Browse files
leeyehsdjdd
andauthored
fix(type): export AV.Error as an interface (#667)
Co-authored-by: Ayumi Sarah <[email protected]>
1 parent 633636f commit c1f26b2

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

storage.d.ts

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,287 +1120,287 @@ export enum LeaderboardVersionChangeInterval {
11201120
MONTH,
11211121
}
11221122

1123-
export class Error {
1124-
code: number;
1125-
message: string;
1126-
rawMessage?: string;
1127-
1128-
constructor(code: number, message: string);
1129-
1123+
export namespace Error {
11301124
/**
11311125
* Error code indicating some error other than those enumerated here.
11321126
*/
1133-
static OTHER_CAUSE: -1;
1127+
export const OTHER_CAUSE: -1;
11341128

11351129
/**
11361130
* Error code indicating that something has gone wrong with the server.
11371131
* If you get this error code, it is AV's fault.
11381132
*/
1139-
static INTERNAL_SERVER_ERROR: 1;
1133+
export const INTERNAL_SERVER_ERROR: 1;
11401134

11411135
/**
11421136
* Error code indicating the connection to the AV servers failed.
11431137
*/
1144-
static CONNECTION_FAILED: 100;
1138+
export const CONNECTION_FAILED: 100;
11451139

11461140
/**
11471141
* Error code indicating the specified object doesn't exist.
11481142
*/
1149-
static OBJECT_NOT_FOUND: 101;
1143+
export const OBJECT_NOT_FOUND: 101;
11501144

11511145
/**
11521146
* Error code indicating you tried to query with a datatype that doesn't
11531147
* support it, like exact matching an array or object.
11541148
*/
1155-
static INVALID_QUERY: 102;
1149+
export const INVALID_QUERY: 102;
11561150

11571151
/**
11581152
* Error code indicating a missing or invalid classname. Classnames are
11591153
* case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
11601154
* only valid characters.
11611155
*/
1162-
static INVALID_CLASS_NAME: 103;
1156+
export const INVALID_CLASS_NAME: 103;
11631157

11641158
/**
11651159
* Error code indicating an unspecified object id.
11661160
*/
1167-
static MISSING_OBJECT_ID: 104;
1161+
export const MISSING_OBJECT_ID: 104;
11681162

11691163
/**
11701164
* Error code indicating an invalid key name. Keys are case-sensitive. They
11711165
* must start with a letter, and a-zA-Z0-9_ are the only valid characters.
11721166
*/
1173-
static INVALID_KEY_NAME: 105;
1167+
export const INVALID_KEY_NAME: 105;
11741168

11751169
/**
11761170
* Error code indicating a malformed pointer. You should not see this unless
11771171
* you have been mucking about changing internal AV code.
11781172
*/
1179-
static INVALID_POINTER: 106;
1173+
export const INVALID_POINTER: 106;
11801174

11811175
/**
11821176
* Error code indicating that badly formed JSON was received upstream. This
11831177
* either indicates you have done something unusual with modifying how
11841178
* things encode to JSON, or the network is failing badly.
11851179
*/
1186-
static INVALID_JSON: 107;
1180+
export const INVALID_JSON: 107;
11871181

11881182
/**
11891183
* Error code indicating that the feature you tried to access is only
11901184
* available internally for testing purposes.
11911185
*/
1192-
static COMMAND_UNAVAILABLE: 108;
1186+
export const COMMAND_UNAVAILABLE: 108;
11931187

11941188
/**
11951189
* You must call AV.initialize before using the AV library.
11961190
*/
1197-
static NOT_INITIALIZED: 109;
1191+
export const NOT_INITIALIZED: 109;
11981192

11991193
/**
12001194
* Error code indicating that a field was set to an inconsistent type.
12011195
*/
1202-
static INCORRECT_TYPE: 111;
1196+
export const INCORRECT_TYPE: 111;
12031197

12041198
/**
12051199
* Error code indicating an invalid channel name. A channel name is either
12061200
* an empty string (the broadcast channel) or contains only a-zA-Z0-9_
12071201
* characters.
12081202
*/
1209-
static INVALID_CHANNEL_NAME: 112;
1203+
export const INVALID_CHANNEL_NAME: 112;
12101204

12111205
/**
12121206
* Error code indicating that push is misconfigured.
12131207
*/
1214-
static PUSH_MISCONFIGURED: 115;
1208+
export const PUSH_MISCONFIGURED: 115;
12151209

12161210
/**
12171211
* Error code indicating that the object is too large.
12181212
*/
1219-
static OBJECT_TOO_LARGE: 116;
1213+
export const OBJECT_TOO_LARGE: 116;
12201214

12211215
/**
12221216
* Error code indicating that the operation isn't allowed for clients.
12231217
*/
1224-
static OPERATION_FORBIDDEN: 119;
1218+
export const OPERATION_FORBIDDEN: 119;
12251219

12261220
/**
12271221
* Error code indicating the result was not found in the cache.
12281222
*/
1229-
static CACHE_MISS: 120;
1223+
export const CACHE_MISS: 120;
12301224

12311225
/**
12321226
* Error code indicating that an invalid key was used in a nested
12331227
* JSONObject.
12341228
*/
1235-
static INVALID_NESTED_KEY: 121;
1229+
export const INVALID_NESTED_KEY: 121;
12361230

12371231
/**
12381232
* Error code indicating that an invalid filename was used for AVFile.
12391233
* A valid file name contains only a-zA-Z0-9_. characters and is between 1
12401234
* and 128 characters.
12411235
*/
1242-
static INVALID_FILE_NAME: 122;
1236+
export const INVALID_FILE_NAME: 122;
12431237

12441238
/**
12451239
* Error code indicating an invalid ACL was provided.
12461240
*/
1247-
static INVALID_ACL: 123;
1241+
export const INVALID_ACL: 123;
12481242

12491243
/**
12501244
* Error code indicating that the request timed out on the server. Typically
12511245
* this indicates that the request is too expensive to run.
12521246
*/
1253-
static TIMEOUT: 124;
1247+
export const TIMEOUT: 124;
12541248

12551249
/**
12561250
* Error code indicating that the email address was invalid.
12571251
*/
1258-
static INVALID_EMAIL_ADDRESS: 125;
1252+
export const INVALID_EMAIL_ADDRESS: 125;
12591253

12601254
/**
12611255
* Error code indicating a missing content type.
12621256
*/
1263-
static MISSING_CONTENT_TYPE: 126;
1257+
export const MISSING_CONTENT_TYPE: 126;
12641258

12651259
/**
12661260
* Error code indicating a missing content length.
12671261
*/
1268-
static MISSING_CONTENT_LENGTH: 127;
1262+
export const MISSING_CONTENT_LENGTH: 127;
12691263

12701264
/**
12711265
* Error code indicating an invalid content length.
12721266
*/
1273-
static INVALID_CONTENT_LENGTH: 128;
1267+
export const INVALID_CONTENT_LENGTH: 128;
12741268

12751269
/**
12761270
* Error code indicating a file that was too large.
12771271
*/
1278-
static FILE_TOO_LARGE: 129;
1272+
export const FILE_TOO_LARGE: 129;
12791273

12801274
/**
12811275
* Error code indicating an error saving a file.
12821276
*/
1283-
static FILE_SAVE_ERROR: 130;
1277+
export const FILE_SAVE_ERROR: 130;
12841278

12851279
/**
12861280
* Error code indicating an error deleting a file.
12871281
*/
1288-
static FILE_DELETE_ERROR: 153;
1282+
export const FILE_DELETE_ERROR: 153;
12891283

12901284
/**
12911285
* Error code indicating that a unique field was given a value that is
12921286
* already taken.
12931287
*/
1294-
static DUPLICATE_VALUE: 137;
1288+
export const DUPLICATE_VALUE: 137;
12951289

12961290
/**
12971291
* Error code indicating that a role's name is invalid.
12981292
*/
1299-
static INVALID_ROLE_NAME: 139;
1293+
export const INVALID_ROLE_NAME: 139;
13001294

13011295
/**
13021296
* Error code indicating that an application quota was exceeded. Upgrade to
13031297
* resolve.
13041298
*/
1305-
static EXCEEDED_QUOTA: 140;
1299+
export const EXCEEDED_QUOTA: 140;
13061300

13071301
/**
13081302
* Error code indicating that a Cloud Code script failed.
13091303
*/
1310-
static SCRIPT_FAILED: 141;
1304+
export const SCRIPT_FAILED: 141;
13111305

13121306
/**
13131307
* Error code indicating that a Cloud Code validation failed.
13141308
*/
1315-
static VALIDATION_ERROR: 142;
1309+
export const VALIDATION_ERROR: 142;
13161310

13171311
/**
13181312
* Error code indicating that invalid image data was provided.
13191313
*/
1320-
static INVALID_IMAGE_DATA: 150;
1314+
export const INVALID_IMAGE_DATA: 150;
13211315

13221316
/**
13231317
* Error code indicating an unsaved file.
13241318
*/
1325-
static UNSAVED_FILE_ERROR: 151;
1319+
export const UNSAVED_FILE_ERROR: 151;
13261320

13271321
/**
13281322
* Error code indicating an invalid push time.
13291323
*/
1330-
static INVALID_PUSH_TIME_ERROR: 152;
1324+
export const INVALID_PUSH_TIME_ERROR: 152;
13311325

13321326
/**
13331327
* Error code indicating that the username is missing or empty.
13341328
*/
1335-
static USERNAME_MISSING: 200;
1329+
export const USERNAME_MISSING: 200;
13361330

13371331
/**
13381332
* Error code indicating that the password is missing or empty.
13391333
*/
1340-
static PASSWORD_MISSING: 201;
1334+
export const PASSWORD_MISSING: 201;
13411335

13421336
/**
13431337
* Error code indicating that the username has already been taken.
13441338
*/
1345-
static USERNAME_TAKEN: 202;
1339+
export const USERNAME_TAKEN: 202;
13461340

13471341
/**
13481342
* Error code indicating that the email has already been taken.
13491343
*/
1350-
static EMAIL_TAKEN: 203;
1344+
export const EMAIL_TAKEN: 203;
13511345

13521346
/**
13531347
* Error code indicating that the email is missing, but must be specified.
13541348
*/
1355-
static EMAIL_MISSING: 204;
1349+
export const EMAIL_MISSING: 204;
13561350

13571351
/**
13581352
* Error code indicating that a user with the specified email was not found.
13591353
*/
1360-
static EMAIL_NOT_FOUND: 205;
1354+
export const EMAIL_NOT_FOUND: 205;
13611355

13621356
/**
13631357
* Error code indicating that a user object without a valid session could
13641358
* not be altered.
13651359
*/
1366-
static SESSION_MISSING: 206;
1360+
export const SESSION_MISSING: 206;
13671361

13681362
/**
13691363
* Error code indicating that a user can only be created through signup.
13701364
*/
1371-
static MUST_CREATE_USER_THROUGH_SIGNUP: 207;
1365+
export const MUST_CREATE_USER_THROUGH_SIGNUP: 207;
13721366

13731367
/**
13741368
* Error code indicating that an an account being linked is already linked
13751369
* to another user.
13761370
*/
1377-
static ACCOUNT_ALREADY_LINKED: 208;
1371+
export const ACCOUNT_ALREADY_LINKED: 208;
13781372

13791373
/**
13801374
* Error code indicating that a user cannot be linked to an account because
13811375
* that account's id could not be found.
13821376
*/
1383-
static LINKED_ID_MISSING: 250;
1377+
export const LINKED_ID_MISSING: 250;
13841378

13851379
/**
13861380
* Error code indicating that a user with a linked (e.g. Facebook) account
13871381
* has an invalid session.
13881382
*/
1389-
static INVALID_LINKED_SESSION: 251;
1383+
export const INVALID_LINKED_SESSION: 251;
13901384

13911385
/**
13921386
* Error code indicating that a service being linked (e.g. Facebook or
13931387
* Twitter) is unsupported.
13941388
*/
1395-
static UNSUPPORTED_SERVICE: 252;
1389+
export const UNSUPPORTED_SERVICE: 252;
13961390

13971391
/**
13981392
* Error code indicating a real error code is unavailable because
13991393
* we had to use an XDomainRequest object to allow CORS requests in
14001394
* Internet Explorer, which strips the body from HTTP responses that have
14011395
* a non-2XX status code.
14021396
*/
1403-
static X_DOMAIN_REQUEST: 602;
1397+
export const X_DOMAIN_REQUEST: 602;
1398+
}
1399+
1400+
export interface Error {
1401+
code: number;
1402+
message: string;
1403+
rawMessage?: string;
14041404
}
14051405

14061406
/**

0 commit comments

Comments
 (0)