@@ -74,7 +74,7 @@ describe('Parse Object', () => {
74
74
return object . destroy ( ) ;
75
75
} ) . then ( ( ) => {
76
76
return object . fetch ( ) ;
77
- } ) . fail ( ( e ) => {
77
+ } ) . catch ( ( e ) => {
78
78
assert . equal ( e . code , Parse . Error . OBJECT_NOT_FOUND ) ;
79
79
done ( ) ;
80
80
} ) ;
@@ -158,7 +158,7 @@ describe('Parse Object', () => {
158
158
} ) . then ( ( itemAgain ) => {
159
159
assert . equal ( item . get ( 'foo' ) , itemAgain . get ( 'foo' ) ) ;
160
160
done ( ) ;
161
- } ) . fail ( e => console . log ( e ) ) ;
161
+ } ) . catch ( done . fail ) ;
162
162
} ) ;
163
163
164
164
it ( 'does not remove old fields on fetch' , ( done ) => {
@@ -248,22 +248,22 @@ describe('Parse Object', () => {
248
248
it ( 'cannot set an invalid date' , ( done ) => {
249
249
let obj = new TestObject ( ) ;
250
250
obj . set ( 'when' , new Date ( Date . parse ( null ) ) ) ;
251
- obj . save ( ) . fail ( ( e ) => {
251
+ obj . save ( ) . catch ( ( e ) => {
252
252
done ( ) ;
253
253
} ) ;
254
254
} ) ;
255
255
256
256
it ( 'cannot create invalid class names' , ( done ) => {
257
257
let item = new Parse . Object ( 'Foo^Bar' ) ;
258
- item . save ( ) . fail ( ( e ) => {
258
+ item . save ( ) . catch ( ( e ) => {
259
259
done ( ) ;
260
260
} ) ;
261
261
} ) ;
262
262
263
263
it ( 'cannot create invalid key names' , ( done ) => {
264
264
let item = new Parse . Object ( 'Item' ) ;
265
265
assert ( ! item . set ( { 'foo^bar' : 'baz' } ) ) ;
266
- item . save ( { 'foo^bar' : 'baz' } ) . fail ( ( e ) => {
266
+ item . save ( { 'foo^bar' : 'baz' } ) . catch ( ( e ) => {
267
267
assert . equal ( e . code , Parse . Error . INVALID_KEY_NAME ) ;
268
268
done ( ) ;
269
269
} ) ;
@@ -788,7 +788,7 @@ describe('Parse Object', () => {
788
788
other = new TestObject ( ) ;
789
789
other . set ( 'number' , 'two' ) ;
790
790
return other . save ( ) ;
791
- } ) . fail ( ( e ) => {
791
+ } ) . catch ( ( e ) => {
792
792
assert . equal ( e . code , Parse . Error . INCORRECT_TYPE ) ;
793
793
other . set ( 'number' , 2 ) ;
794
794
return other . save ( ) ;
@@ -939,7 +939,7 @@ describe('Parse Object', () => {
939
939
let bryan = new PickyEater ( ) ;
940
940
bryan . save ( { meal : 'burrito' } ) . then ( ( ) => {
941
941
return bryan . save ( { meal : 'tomatoes' } ) ;
942
- } ) . fail ( ( e ) => {
942
+ } ) . catch ( ( e ) => {
943
943
assert . equal ( e , 'Ew. Gross.' ) ;
944
944
done ( ) ;
945
945
} ) ;
@@ -978,7 +978,7 @@ describe('Parse Object', () => {
978
978
} ) . then ( ( ) => {
979
979
let query = new Parse . Query ( TestObject ) ;
980
980
return query . get ( o . id ) ;
981
- } ) . fail ( ( e ) => {
981
+ } ) . catch ( ( e ) => {
982
982
assert . equal ( e . code , Parse . Error . OBJECT_NOT_FOUND ) ;
983
983
done ( ) ;
984
984
} ) ;
@@ -1004,7 +1004,7 @@ describe('Parse Object', () => {
1004
1004
it ( 'can destroyAll an object that does not exist' , ( done ) => {
1005
1005
let o = new TestObject ( ) ;
1006
1006
o . id = 'fakeobject' ;
1007
- Parse . Object . destroyAll ( [ o ] ) . fail ( ( e ) => {
1007
+ Parse . Object . destroyAll ( [ o ] ) . catch ( ( e ) => {
1008
1008
assert . equal ( e . code , Parse . Error . AGGREGATE_ERROR ) ;
1009
1009
assert . equal ( e . errors . length , 1 ) ;
1010
1010
done ( ) ;
@@ -1019,7 +1019,7 @@ describe('Parse Object', () => {
1019
1019
Parse . Object . saveAll ( objects ) . then ( ( ) => {
1020
1020
objects [ 0 ] . id = 'fakeobject' ;
1021
1021
return Parse . Object . destroyAll ( objects ) ;
1022
- } ) . fail ( ( e ) => {
1022
+ } ) . catch ( ( e ) => {
1023
1023
assert . equal ( e . code , Parse . Error . AGGREGATE_ERROR ) ;
1024
1024
assert . equal ( e . errors . length , 1 ) ;
1025
1025
assert . equal ( e . errors [ 0 ] . code , Parse . Error . OBJECT_NOT_FOUND ) ;
@@ -1036,7 +1036,7 @@ describe('Parse Object', () => {
1036
1036
Parse . Object . saveAll ( objects ) . then ( ( ) => {
1037
1037
objects [ 19 ] . id = 'fakeobject' ;
1038
1038
return Parse . Object . destroyAll ( objects ) ;
1039
- } ) . fail ( ( e ) => {
1039
+ } ) . catch ( ( e ) => {
1040
1040
assert . equal ( e . code , Parse . Error . AGGREGATE_ERROR ) ;
1041
1041
assert . equal ( e . errors . length , 1 ) ;
1042
1042
assert . equal ( e . errors [ 0 ] . code , Parse . Error . OBJECT_NOT_FOUND ) ;
@@ -1053,7 +1053,7 @@ describe('Parse Object', () => {
1053
1053
Parse . Object . saveAll ( objects ) . then ( ( ) => {
1054
1054
objects [ 20 ] . id = 'fakeobject' ;
1055
1055
return Parse . Object . destroyAll ( objects ) ;
1056
- } ) . fail ( ( e ) => {
1056
+ } ) . catch ( ( e ) => {
1057
1057
assert . equal ( e . code , Parse . Error . AGGREGATE_ERROR ) ;
1058
1058
assert . equal ( e . errors . length , 1 ) ;
1059
1059
assert . equal ( e . errors [ 0 ] . code , Parse . Error . OBJECT_NOT_FOUND ) ;
@@ -1072,7 +1072,7 @@ describe('Parse Object', () => {
1072
1072
objects [ 19 ] . id = 'fakeobject' ;
1073
1073
objects [ 20 ] . id = 'fakeobject' ;
1074
1074
return Parse . Object . destroyAll ( objects ) ;
1075
- } ) . fail ( ( e ) => {
1075
+ } ) . catch ( ( e ) => {
1076
1076
assert . equal ( e . code , Parse . Error . AGGREGATE_ERROR ) ;
1077
1077
assert . equal ( e . errors . length , 3 ) ;
1078
1078
assert . equal ( e . errors [ 0 ] . code , Parse . Error . OBJECT_NOT_FOUND ) ;
@@ -1157,14 +1157,14 @@ describe('Parse Object', () => {
1157
1157
let itemAgain = containerAgain . get ( 'item' ) ;
1158
1158
let multiClassArray = [ subContainerAgain , itemAgain ] ;
1159
1159
return Parse . Object . fetchAll ( multiClassArray ) ;
1160
- } ) . fail ( ( e ) => {
1160
+ } ) . catch ( ( e ) => {
1161
1161
assert . equal ( e . code , Parse . Error . INVALID_CLASS_NAME ) ;
1162
1162
} ) ;
1163
1163
} ) ;
1164
1164
1165
1165
it ( 'fails fetchAll on unsaved object' , ( ) => {
1166
1166
let unsavedObjectArray = [ new TestObject ( ) ] ;
1167
- return Parse . Object . fetchAll ( unsavedObjectArray ) . fail ( ( e ) => {
1167
+ return Parse . Object . fetchAll ( unsavedObjectArray ) . catch ( ( e ) => {
1168
1168
assert . equal ( e . code , Parse . Error . MISSING_OBJECT_ID ) ;
1169
1169
} ) ;
1170
1170
} ) ;
@@ -1188,7 +1188,7 @@ describe('Parse Object', () => {
1188
1188
let nonExistentObject = new Item ( { objectId : deletedObject . id } ) ;
1189
1189
let nonExistentObjectArray = [ nonExistentObject , items [ 1 ] ] ;
1190
1190
return Parse . Object . fetchAll ( nonExistentObjectArray ) ;
1191
- } ) . fail ( ( e ) => {
1191
+ } ) . catch ( ( e ) => {
1192
1192
assert . equal ( e . code , Parse . Error . OBJECT_NOT_FOUND ) ;
1193
1193
done ( ) ;
1194
1194
} ) ;
@@ -1265,7 +1265,7 @@ describe('Parse Object', () => {
1265
1265
1266
1266
it ( 'can fetchAllIfNeeded with an unsaved object' , ( ) => {
1267
1267
let unsavedObjectArray = [ new TestObject ( ) ] ;
1268
- Parse . Object . fetchAllIfNeeded ( unsavedObjectArray ) . fail ( ( e ) => {
1268
+ Parse . Object . fetchAllIfNeeded ( unsavedObjectArray ) . catch ( ( e ) => {
1269
1269
assert . equal ( e . code , Parse . Error . MISSING_OBJECT_ID ) ;
1270
1270
done ( ) ;
1271
1271
} ) ;
@@ -1283,7 +1283,7 @@ describe('Parse Object', () => {
1283
1283
let itemAgain = containerAgain . get ( 'item' ) ;
1284
1284
let multiClassArray = [ subContainerAgain , itemAgain ] ;
1285
1285
return Parse . Object . fetchAllIfNeeded ( multiClassArray ) ;
1286
- } ) . fail ( ( e ) => {
1286
+ } ) . catch ( ( e ) => {
1287
1287
assert . equal ( e . code , Parse . Error . INVALID_CLASS_NAME ) ;
1288
1288
} ) ;
1289
1289
} ) ;
0 commit comments