Skip to content
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

Can't Handle Symbol() Attribute On Error Object #68

Open
ki4jnq opened this issue Jun 25, 2018 · 1 comment
Open

Can't Handle Symbol() Attribute On Error Object #68

ki4jnq opened this issue Jun 25, 2018 · 1 comment
Labels

Comments

@ki4jnq
Copy link

ki4jnq commented Jun 25, 2018

We attach Symbol() type attributes to our known error conditions in our Express application. When Raygun tries to serialize these attributes the following error is raised:

TypeError: Cannot convert a Symbol value to a string
    at toHumanString (/Users/myusername/Projects/myProjectName/node_modules/object-to-human-string/lib/index.js:29:63)
    at RaygunMessageBuilder.setErrorDetails (/Users/myusername/Projects/myProjectName/node_modules/raygun/lib/raygun.messageBuilder.js:54:15)
    at Raygun.raygun.send (/Users/myusername/Projects/myProjectName/node_modules/raygun/lib/raygun.js:98:14)
    at Raygun.raygun.expressHandler (/Users/myusername/Projects/myProjectName/node_modules/raygun/lib/raygun.js:144:16)
    at WebFrameworkShim.applySegment (/Users/myusername/Projects/myProjectName/node_modules/newrelic/lib/shim/shim.js:1332:17)
    at _applyRecorderSegment (/Users/myusername/Projects/myProjectName/node_modules/newrelic/lib/shim/shim.js:949:20)
    at _doRecord (/Users/myusername/Projects/myProjectName/node_modules/newrelic/lib/shim/shim.js:928:17)
    at /Users/myusername/Projects/myProjectName/node_modules/newrelic/lib/shim/shim.js:913:24
    at Layer.handle_error (/Users/myusername/Projects/myProjectName/node_modules/express/lib/router/layer.js:71:5)
    at trim_prefix (/Users/myusername/Projects/myProjectName/node_modules/express/lib/router/index.js:315:13)

It appears that object-to-human-string tries to concatenate strings using the + operator, which specifically throws the above type error. It seems to me that attaching Symbol() metadata to error objects should not cause an error to be thrown.

Thanks for a great tool!

@UberMouse
Copy link
Contributor

Hi @ki4jnq,

We will see what we can do to actually fix this and get back to you. But for now, a workaround might be to set useHumanStringForObject to false in the options object passed to init.

Regards,
Taylor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Needs Triage
Development

No branches or pull requests

3 participants