@@ -807,6 +807,20 @@ describe('globals', function() {
807
807
Raven . _processException ( 'TypeError' , undefined , 'http://example.com' , [ ] ) ;
808
808
assert . isTrue ( Raven . _send . called ) ;
809
809
} ) ;
810
+
811
+ // `throw ''` scenario. TraceKit always defaults to '' for message and 'null' for name if not parseable
812
+ // It's required to preserve minimal (1 frame only) stack on the server and let user to see
813
+ // at least something, otherwise whole exception interface will be dropped
814
+ // and nothing will allow user to determine where this error came from
815
+ it ( 'should override message if neither type or message are present' , function ( ) {
816
+ this . sinon . stub ( Raven , '_send' ) ;
817
+
818
+ Raven . _processException ( null , '' , 'http://example.com' , [ ] ) ;
819
+ assert . equal (
820
+ Raven . _send . lastCall . args [ 0 ] . exception . values [ 0 ] . value ,
821
+ 'Unrecoverable error caught'
822
+ ) ;
823
+ } ) ;
810
824
} ) ;
811
825
812
826
if ( supportsPromiseRejectionEvent ( ) ) {
@@ -3122,6 +3136,19 @@ describe('Raven (public API)', function() {
3122
3136
// but wrapped in an array
3123
3137
assert . deepEqual ( fingerprint , [ 'foo' ] ) ;
3124
3138
} ) ;
3139
+
3140
+ it ( 'should get collected if captureMessage was called with an empty string' , function ( ) {
3141
+ this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
3142
+ this . sinon . stub ( Raven , '_send' ) ;
3143
+
3144
+ function foo ( ) {
3145
+ Raven . captureMessage ( '' ) ;
3146
+ }
3147
+
3148
+ foo ( ) ;
3149
+ var data = Raven . _send . lastCall . args [ 0 ] ;
3150
+ assertSynthetic ( data . stacktrace . frames ) ;
3151
+ } ) ;
3125
3152
} ) ;
3126
3153
} ) ;
3127
3154
0 commit comments