@@ -807,6 +807,20 @@ describe('globals', function() {
807807 Raven . _processException ( 'TypeError' , undefined , 'http://example.com' , [ ] ) ;
808808 assert . isTrue ( Raven . _send . called ) ;
809809 } ) ;
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+ } ) ;
810824 } ) ;
811825
812826 if ( supportsPromiseRejectionEvent ( ) ) {
@@ -3122,6 +3136,19 @@ describe('Raven (public API)', function() {
31223136 // but wrapped in an array
31233137 assert . deepEqual ( fingerprint , [ 'foo' ] ) ;
31243138 } ) ;
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+ } ) ;
31253152 } ) ;
31263153 } ) ;
31273154
0 commit comments