nylas / nylas-nodejs

A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
MIT License
169 stars 118 forks source link

Don't use console.error #456

Closed yulianovdey closed 9 months ago

yulianovdey commented 1 year ago

Describe the bug There is a console.error call here we can't route through our logging handler. This is particularly an issue with Datadog because err.stack ends up including new lines and every line ends up as a separate log statement.

To Reproduce We see this happen whenever a server error is returned from Nylas.

Expected behavior nylas-nodejs does not log anything directly, and instead offers an option to toggle this behavior, or provides a way to inject a logger.

SDK Version: Latest.

Additional context It looks like calls to console.log were removed in 3.1.1, but this error log was kept in.

Thank you!

mrashed-dev commented 1 year ago

Hey @yulianovdey! Thanks for opening this issue. We can remedy this by removing that console.error line and instead we can just intercept the error and throw an SDK specific error with the original message embedded with it. We'll fix this and include it in a future update. Thanks for opening this issue!

relaxedtomato commented 11 months ago

approach to fix:

mrashed-dev commented 9 months ago

Thanks for your patience @yulianovdey, we now remove the console calls and allow you to pass in a logger if you want to receive messages.