@@ -1188,13 +1188,9 @@ describe('Raven (public API)', function() {
1188
1188
1189
1189
it ( 'should re-raise a thrown exception' , function ( ) {
1190
1190
var error = new Error ( 'lol' ) ;
1191
- try {
1191
+ assert . throws ( function ( ) {
1192
1192
Raven . wrap ( function ( ) { throw error ; } ) ( ) ;
1193
- } catch ( e ) {
1194
- return assert . equal ( e , error ) ;
1195
- }
1196
- // Shouldn't hit this
1197
- assert . isTrue ( false ) ;
1193
+ } , error ) ;
1198
1194
} ) ;
1199
1195
1200
1196
} ) ;
@@ -1227,11 +1223,9 @@ describe('Raven (public API)', function() {
1227
1223
var error = new Error ( 'crap' ) ;
1228
1224
var broken = function ( ) { throw error ; } ;
1229
1225
this . sinon . stub ( Raven , 'captureException' ) ;
1230
- try {
1231
- Raven . context ( { 'foo' : 'bar' } , broken ) ;
1232
- } catch ( e ) {
1233
- assert . equal ( e , error ) ;
1234
- }
1226
+ assert . throws ( function ( ) {
1227
+ Raven . context ( { foo : 'bar' } , broken ) ;
1228
+ } , error ) ;
1235
1229
assert . isTrue ( Raven . captureException . called ) ;
1236
1230
assert . deepEqual ( Raven . captureException . lastCall . args , [ error , { 'foo' : 'bar' } ] ) ;
1237
1231
} ) ;
@@ -1240,11 +1234,9 @@ describe('Raven (public API)', function() {
1240
1234
var error = new Error ( 'crap' ) ;
1241
1235
var broken = function ( ) { throw error ; } ;
1242
1236
this . sinon . stub ( Raven , 'captureException' ) ;
1243
- try {
1237
+ assert . throws ( function ( ) {
1244
1238
Raven . context ( broken ) ;
1245
- } catch ( e ) {
1246
- assert . equal ( e , error ) ;
1247
- }
1239
+ } , error ) ;
1248
1240
assert . isTrue ( Raven . captureException . called ) ;
1249
1241
assert . deepEqual ( Raven . captureException . lastCall . args , [ error , undefined ] ) ;
1250
1242
} ) ;
@@ -1340,13 +1332,9 @@ describe('Raven (public API)', function() {
1340
1332
it ( 'should reraise a different error' , function ( ) {
1341
1333
var error = new Error ( 'crap1' ) ;
1342
1334
this . sinon . stub ( TraceKit , 'report' ) . throws ( error ) ;
1343
- try {
1335
+ assert . throws ( function ( ) {
1344
1336
Raven . captureException ( new Error ( 'crap2' ) ) ;
1345
- } catch ( e ) {
1346
- return assert . equal ( e , error ) ;
1347
- }
1348
- // shouldn't hit this
1349
- assert . isTrue ( false ) ;
1337
+ } , error ) ;
1350
1338
} ) ;
1351
1339
1352
1340
it ( 'should capture as a normal message if a string is passed' , function ( ) {
0 commit comments