Skip to content

Commit f6e4c0b

Browse files
committed
fix(d.ts): remove the intermediate ErrorCode class
1 parent 073d584 commit f6e4c0b

File tree

2 files changed

+278
-60
lines changed

2 files changed

+278
-60
lines changed

src/error.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ _.extend(
2121

2222
/**
2323
* Error code indicating that something has gone wrong with the server.
24-
* If you get this error code, it is AV's fault. Contact us at
25-
* https://avoscloud.com/help
24+
* If you get this error code, it is AV's fault.
2625
* @constant
2726
*/
2827
INTERNAL_SERVER_ERROR: 1,
@@ -249,6 +248,7 @@ _.extend(
249248

250249
/**
251250
* Error code indicating an invalid push time.
251+
* @constant
252252
*/
253253
INVALID_PUSH_TIME_ERROR: 152,
254254

storage.d.ts

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

1123-
export class Error extends ErrorCode {
1123+
export class Error {
11241124
code: number;
11251125
message: string;
1126+
rawMessage?: string;
11261127

11271128
constructor(code: number, message: string);
1128-
}
11291129

1130-
declare class ErrorCode {
1131-
static OTHER_CAUSE: number;
1132-
static INTERNAL_SERVER_ERROR: number;
1133-
static CONNECTION_FAILED: number;
1134-
static OBJECT_NOT_FOUND: number;
1135-
static INVALID_QUERY: number;
1136-
static INVALID_CLASS_NAME: number;
1137-
static MISSING_OBJECT_ID: number;
1138-
static INVALID_KEY_NAME: number;
1139-
static INVALID_POINTER: number;
1140-
static INVALID_JSON: number;
1141-
static COMMAND_UNAVAILABLE: number;
1142-
static NOT_INITIALIZED: number;
1143-
static INCORRECT_TYPE: number;
1144-
static INVALID_CHANNEL_NAME: number;
1145-
static PUSH_MISCONFIGURED: number;
1146-
static OBJECT_TOO_LARGE: number;
1147-
static OPERATION_FORBIDDEN: number;
1148-
static CACHE_MISS: number;
1149-
static INVALID_NESTED_KEY: number;
1150-
static INVALID_FILE_NAME: number;
1151-
static INVALID_ACL: number;
1152-
static TIMEOUT: number;
1153-
static INVALID_EMAIL_ADDRESS: number;
1154-
static MISSING_CONTENT_TYPE: number;
1155-
static MISSING_CONTENT_LENGTH: number;
1156-
static INVALID_CONTENT_LENGTH: number;
1157-
static FILE_TOO_LARGE: number;
1158-
static FILE_SAVE_ERROR: number;
1159-
static DUPLICATE_VALUE: number;
1160-
static INVALID_ROLE_NAME: number;
1161-
static EXCEEDED_QUOTA: number;
1162-
static SCRIPT_FAILED: number;
1163-
static VALIDATION_ERROR: number;
1164-
static INVALID_IMAGE_DATA: number;
1165-
static UNSAVED_FILE_ERROR: number;
1166-
static INVALID_PUSH_TIME_ERROR: number;
1167-
static FILE_DELETE_ERROR: number;
1168-
static REQUEST_LIMIT_EXCEEDED: number;
1169-
static INVALID_EVENT_NAME: number;
1170-
static USERNAME_MISSING: number;
1171-
static PASSWORD_MISSING: number;
1172-
static USERNAME_TAKEN: number;
1173-
static EMAIL_TAKEN: number;
1174-
static EMAIL_MISSING: number;
1175-
static EMAIL_NOT_FOUND: number;
1176-
static SESSION_MISSING: number;
1177-
static MUST_CREATE_USER_THROUGH_SIGNUP: number;
1178-
static ACCOUNT_ALREADY_LINKED: number;
1179-
static INVALID_SESSION_TOKEN: number;
1180-
static LINKED_ID_MISSING: number;
1181-
static INVALID_LINKED_SESSION: number;
1182-
static UNSUPPORTED_SERVICE: number;
1183-
static AGGREGATE_ERROR: number;
1184-
static FILE_READ_ERROR: number;
1185-
static X_DOMAIN_REQUEST: number;
1130+
/**
1131+
* Error code indicating some error other than those enumerated here.
1132+
*/
1133+
static OTHER_CAUSE: -1;
1134+
1135+
/**
1136+
* Error code indicating that something has gone wrong with the server.
1137+
* If you get this error code, it is AV's fault.
1138+
*/
1139+
static INTERNAL_SERVER_ERROR: 1;
1140+
1141+
/**
1142+
* Error code indicating the connection to the AV servers failed.
1143+
*/
1144+
static CONNECTION_FAILED: 100;
1145+
1146+
/**
1147+
* Error code indicating the specified object doesn't exist.
1148+
*/
1149+
static OBJECT_NOT_FOUND: 101;
1150+
1151+
/**
1152+
* Error code indicating you tried to query with a datatype that doesn't
1153+
* support it, like exact matching an array or object.
1154+
*/
1155+
static INVALID_QUERY: 102;
1156+
1157+
/**
1158+
* Error code indicating a missing or invalid classname. Classnames are
1159+
* case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1160+
* only valid characters.
1161+
*/
1162+
static INVALID_CLASS_NAME: 103;
1163+
1164+
/**
1165+
* Error code indicating an unspecified object id.
1166+
*/
1167+
static MISSING_OBJECT_ID: 104;
1168+
1169+
/**
1170+
* Error code indicating an invalid key name. Keys are case-sensitive. They
1171+
* must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1172+
*/
1173+
static INVALID_KEY_NAME: 105;
1174+
1175+
/**
1176+
* Error code indicating a malformed pointer. You should not see this unless
1177+
* you have been mucking about changing internal AV code.
1178+
*/
1179+
static INVALID_POINTER: 106;
1180+
1181+
/**
1182+
* Error code indicating that badly formed JSON was received upstream. This
1183+
* either indicates you have done something unusual with modifying how
1184+
* things encode to JSON, or the network is failing badly.
1185+
*/
1186+
static INVALID_JSON: 107;
1187+
1188+
/**
1189+
* Error code indicating that the feature you tried to access is only
1190+
* available internally for testing purposes.
1191+
*/
1192+
static COMMAND_UNAVAILABLE: 108;
1193+
1194+
/**
1195+
* You must call AV.initialize before using the AV library.
1196+
*/
1197+
static NOT_INITIALIZED: 109;
1198+
1199+
/**
1200+
* Error code indicating that a field was set to an inconsistent type.
1201+
*/
1202+
static INCORRECT_TYPE: 111;
1203+
1204+
/**
1205+
* Error code indicating an invalid channel name. A channel name is either
1206+
* an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1207+
* characters.
1208+
*/
1209+
static INVALID_CHANNEL_NAME: 112;
1210+
1211+
/**
1212+
* Error code indicating that push is misconfigured.
1213+
*/
1214+
static PUSH_MISCONFIGURED: 115;
1215+
1216+
/**
1217+
* Error code indicating that the object is too large.
1218+
*/
1219+
static OBJECT_TOO_LARGE: 116;
1220+
1221+
/**
1222+
* Error code indicating that the operation isn't allowed for clients.
1223+
*/
1224+
static OPERATION_FORBIDDEN: 119;
1225+
1226+
/**
1227+
* Error code indicating the result was not found in the cache.
1228+
*/
1229+
static CACHE_MISS: 120;
1230+
1231+
/**
1232+
* Error code indicating that an invalid key was used in a nested
1233+
* JSONObject.
1234+
*/
1235+
static INVALID_NESTED_KEY: 121;
1236+
1237+
/**
1238+
* Error code indicating that an invalid filename was used for AVFile.
1239+
* A valid file name contains only a-zA-Z0-9_. characters and is between 1
1240+
* and 128 characters.
1241+
*/
1242+
static INVALID_FILE_NAME: 122;
1243+
1244+
/**
1245+
* Error code indicating an invalid ACL was provided.
1246+
*/
1247+
static INVALID_ACL: 123;
1248+
1249+
/**
1250+
* Error code indicating that the request timed out on the server. Typically
1251+
* this indicates that the request is too expensive to run.
1252+
*/
1253+
static TIMEOUT: 124;
1254+
1255+
/**
1256+
* Error code indicating that the email address was invalid.
1257+
*/
1258+
static INVALID_EMAIL_ADDRESS: 125;
1259+
1260+
/**
1261+
* Error code indicating a missing content type.
1262+
*/
1263+
static MISSING_CONTENT_TYPE: 126;
1264+
1265+
/**
1266+
* Error code indicating a missing content length.
1267+
*/
1268+
static MISSING_CONTENT_LENGTH: 127;
1269+
1270+
/**
1271+
* Error code indicating an invalid content length.
1272+
*/
1273+
static INVALID_CONTENT_LENGTH: 128;
1274+
1275+
/**
1276+
* Error code indicating a file that was too large.
1277+
*/
1278+
static FILE_TOO_LARGE: 129;
1279+
1280+
/**
1281+
* Error code indicating an error saving a file.
1282+
*/
1283+
static FILE_SAVE_ERROR: 130;
1284+
1285+
/**
1286+
* Error code indicating an error deleting a file.
1287+
*/
1288+
static FILE_DELETE_ERROR: 153;
1289+
1290+
/**
1291+
* Error code indicating that a unique field was given a value that is
1292+
* already taken.
1293+
*/
1294+
static DUPLICATE_VALUE: 137;
1295+
1296+
/**
1297+
* Error code indicating that a role's name is invalid.
1298+
*/
1299+
static INVALID_ROLE_NAME: 139;
1300+
1301+
/**
1302+
* Error code indicating that an application quota was exceeded. Upgrade to
1303+
* resolve.
1304+
*/
1305+
static EXCEEDED_QUOTA: 140;
1306+
1307+
/**
1308+
* Error code indicating that a Cloud Code script failed.
1309+
*/
1310+
static SCRIPT_FAILED: 141;
1311+
1312+
/**
1313+
* Error code indicating that a Cloud Code validation failed.
1314+
*/
1315+
static VALIDATION_ERROR: 142;
1316+
1317+
/**
1318+
* Error code indicating that invalid image data was provided.
1319+
*/
1320+
static INVALID_IMAGE_DATA: 150;
1321+
1322+
/**
1323+
* Error code indicating an unsaved file.
1324+
*/
1325+
static UNSAVED_FILE_ERROR: 151;
1326+
1327+
/**
1328+
* Error code indicating an invalid push time.
1329+
*/
1330+
static INVALID_PUSH_TIME_ERROR: 152;
1331+
1332+
/**
1333+
* Error code indicating that the username is missing or empty.
1334+
*/
1335+
static USERNAME_MISSING: 200;
1336+
1337+
/**
1338+
* Error code indicating that the password is missing or empty.
1339+
*/
1340+
static PASSWORD_MISSING: 201;
1341+
1342+
/**
1343+
* Error code indicating that the username has already been taken.
1344+
*/
1345+
static USERNAME_TAKEN: 202;
1346+
1347+
/**
1348+
* Error code indicating that the email has already been taken.
1349+
*/
1350+
static EMAIL_TAKEN: 203;
1351+
1352+
/**
1353+
* Error code indicating that the email is missing, but must be specified.
1354+
*/
1355+
static EMAIL_MISSING: 204;
1356+
1357+
/**
1358+
* Error code indicating that a user with the specified email was not found.
1359+
*/
1360+
static EMAIL_NOT_FOUND: 205;
1361+
1362+
/**
1363+
* Error code indicating that a user object without a valid session could
1364+
* not be altered.
1365+
*/
1366+
static SESSION_MISSING: 206;
1367+
1368+
/**
1369+
* Error code indicating that a user can only be created through signup.
1370+
*/
1371+
static MUST_CREATE_USER_THROUGH_SIGNUP: 207;
1372+
1373+
/**
1374+
* Error code indicating that an an account being linked is already linked
1375+
* to another user.
1376+
*/
1377+
static ACCOUNT_ALREADY_LINKED: 208;
1378+
1379+
/**
1380+
* Error code indicating that a user cannot be linked to an account because
1381+
* that account's id could not be found.
1382+
*/
1383+
static LINKED_ID_MISSING: 250;
1384+
1385+
/**
1386+
* Error code indicating that a user with a linked (e.g. Facebook) account
1387+
* has an invalid session.
1388+
*/
1389+
static INVALID_LINKED_SESSION: 251;
1390+
1391+
/**
1392+
* Error code indicating that a service being linked (e.g. Facebook or
1393+
* Twitter) is unsupported.
1394+
*/
1395+
static UNSUPPORTED_SERVICE: 252;
1396+
1397+
/**
1398+
* Error code indicating a real error code is unavailable because
1399+
* we had to use an XDomainRequest object to allow CORS requests in
1400+
* Internet Explorer, which strips the body from HTTP responses that have
1401+
* a non-2XX status code.
1402+
*/
1403+
static X_DOMAIN_REQUEST: 602;
11861404
}
11871405

11881406
/**

0 commit comments

Comments
 (0)