- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.7k
 
Capture message respects ignoreUrls/whitelistUrls #774 #1080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capture message respects ignoreUrls/whitelistUrls #774 #1080
Conversation
        
          
                docs/config.rst
              
                Outdated
          
        
      | filter out any values. | ||
| 
               | 
          ||
| Does not affect ``captureMessage`` or when non-error object is passed in | ||
| Does not affect when non-error object is passed in | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be true anymore with this PR, as Raven.captureException({foo: 'bar'}), will end up calling Raven.captureMessage https://github.com/getsentry/raven-js/blob/master/src/raven.js#L378-L389
        
          
                docs/config.rst
              
                Outdated
          
        
      | regular expressions or strings. | ||
| 
               | 
          ||
| Does not affect captureMessage or when non-error object is passed in | ||
| Does not affect when non-error object is passed in | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
        
          
                docs/config.rst
              
                Outdated
          
        
      | } | ||
| Does not affect captureMessage or when non-error object is passed in | ||
| Does not affect when non-error object is passed in | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
        
          
                src/raven.js
              
                Outdated
          
        
      | if ( | ||
| !!this._globalOptions.ignoreUrls.test && | ||
| this._globalOptions.ignoreUrls.test(fileurl) | ||
| ) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap return statement in curly braces
| !!this._globalOptions.whitelistUrls.test && | ||
| !this._globalOptions.whitelistUrls.test(fileurl) | ||
| ) | ||
| return; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
        
          
                src/raven.js
              
                Outdated
          
        
      | ex.name = null; | ||
| var stack = TraceKit.computeStackTrace(ex); | ||
| 
               | 
          ||
| var prvCall = stack.stack[1]; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call this initialCall to give it more meaning. Also please add comment about why it's 2nd frame, not the top one – similar to here https://github.com/getsentry/raven-node/blob/master/lib/client.js#L337
        
          
                test/raven.test.js
              
                Outdated
          
        
      | Raven._globalOptions.whitelistUrls = joinRegExp([/.+?host1.+/, /.+?host2.+/]); | ||
| TraceKitStub.returns({stack: [{url: 'http://host1/'}, {url: 'http://host1/'}]}); | ||
| Raven.captureMessage('Capture!'); | ||
| assert.equal(Raven._send.callCount, 1); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use assert.isTrue(Raven._send.calledOnce); and assert.isTrue(Raven._send.calledTwice); to be more consistent with the next test (which uses callOnce attribute).
| 
           Thanks for contributing @HeroProtagonist! Just a few minor requests and we're good to go :)  | 
    
| 
           @kamilogorek Thanks for the review! I have updated my PR reflecting your comments  | 
    
| 
           Aaaand it's merged! Thanks @HeroProtagonist! :)  | 
    
| 
           🙌 Huge!  | 
    
resolves #774
captureMessagewill now respect ignoreUrls/whitelistUrlscaptureMessage. The stack trace of this error will be used to test the file url and see if it matches ignoreUrls/whitelistUrls.