Giter Site home page Giter Site logo

Comments (7)

kamilogorek avatar kamilogorek commented on June 13, 2024 1

Aaaaaghr... I again misread that its raven-js issue. @eladhaz05 for now, please use shouldSendCallback for this purpose.

@adamchainz I totally agree. We are in the process of unifying all JS SDKs and it soon won't be an issue. It'll take a while, but we'll get there soon :)

from raven-node.

adamreisnz avatar adamreisnz commented on June 13, 2024 1

I've written a custom helper for this based on code found in raven-js, you can use it to support ignoreErrors while waiting for the SDK's to be unified.

Helper:

/**
 * Join an array of string/regex patterns into a single regex (adapted from raven-js)
 */
function joinRegex(patterns) {

  //Initialize sources
  const sources = [];

  //Loop patterns
  for (const pattern of patterns) {

    //If it's a string, we need to escape it
    if (typeof pattern === 'string') {
      sources.push(pattern.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'));
    }

    //If it's a regular expression already, we want to extract the source
    else if (pattern && pattern.source) {
      sources.push(pattern.source);
    }

    //Intentionally skip other cases
  }

  //Return combined regular expression
  return new RegExp(sources.join('|'), 'i');
}

Configuration converter:

if (Array.isArray(cfg.ignoreErrors) && cfg.ignoreErrors.length > 0) {
  const ignoreErrors = joinRegex(cfg.ignoreErrors);
  cfg.shouldSendCallback = function(data) {
    if (data.message && typeof data.message.match === 'function') {
      return !data.message.match(ignoreErrors);
    }
    return true;
  };
}

This essentially defines a shouldSendCallback config property if you've passed ignoreErrors instead.

from raven-node.

kamilogorek avatar kamilogorek commented on June 13, 2024

Can you please provide an event that should but is not matching this errors filter?

You can gather them using

Raven.config('__DSN__', {
  dataCallback: function (event) {
    console.log(JSON.stringify(event, null, 2));
  }
})

Cheers!

from raven-node.

adamreisnz avatar adamreisnz commented on June 13, 2024

I don't think the ignoreErrors configuration exists for the Node client.
It's not documented at all, and #202 implies it has never been built.

I too would prefer support for ignoreErrors though, because it's easier for admins to add lines to simple configuration like that instead of messing with a callback. It's also not documented what format data has that is passed to shouldSendCallback.

from raven-node.

adamchainz avatar adamchainz commented on June 13, 2024

you @'d the wrong adam

from raven-node.

kamilogorek avatar kamilogorek commented on June 13, 2024

Haha, sorry @adamchainz! And thanks for letting me know 🤦‍♂️
cc @adamreisnz

from raven-node.

adamreisnz avatar adamreisnz commented on June 13, 2024

Hah, similar names :)

@kamilogorek great to hear, look forward to a unified SDK!

from raven-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.