Can't send custom data as JS object for more than one key-value pair

simond

Posted on
Oct 31 2015

Hi, I'm having trouble sending custom data using more than one key-value pair in the returned object .

For example, the returned object from the below syntax when inspected in the browser dev console has a "null" value for the error object. And no "Custom" data tab in the dashboard appears even though the error is reported as sent to Raygun:

  function returnErrorObj {
    var errObj =
    { Error: theError,
      Title: theTitle,
      Description: theDescription,
    };

    return errObj;
  }

  Raygun.send(Error('Custom error'), returnErrorObj);

However when I use a single key-value pair, the Custom tab does appear and display the value.

What am I missing?


Daniel

Posted on
Nov 02 2015

Hi Simon,

returnErrorObj is a function - when calling Raygun, you need to put ()'s after it. We drop objects that can't be serialized such as functions.

Eg

Raygun.send(Error('Custom error'), returnErrorObj());

Hope this helps!

Regards, Daniel


simond

Posted on
Nov 03 2015

Ugh, thank you! Glad it was something simple :)


Reply