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

Update memcached.js #276

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

raykovskyy
Copy link

No description provided.

console.log('Invalid JSON data', e, dataSet);
            dataSet = {};
try{
dataSet = JSON.parse(dataSet);
}catch(e){
console.log('Invalid JSON data', e, dataSet);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of using console.log to notify about errors. Libraries should avoid output to stdout/stderr imho. Other than that, try try/catch block is a good idea.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing silently can cause lots of head-scratching for the users of the library too if something goes wrong...

Maybe passing a flag (like verbose=true or something like that) or a custom logger object (that can have the log level disabled) in the client constructor would be a more appropriate alternative?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say emitting an error would be more appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants