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

Display full error object all the time regardless of argument position #958

Open
ggfrosch opened this issue Feb 23, 2024 · 0 comments
Open

Comments

@ggfrosch
Copy link

ggfrosch commented Feb 23, 2024

A quick explanation:

var debug = require('debug')('http');

const error = new Error('hi');
error.info= { display: 'me' };
debug(error) ;
debug('', error); // this will output info object 

This is not mentioned in the readme and I had to hunt the reason for this. If an error is the first argument, it will be coerced.

args[0] = createDebug.coerce(args[0]);

At the very least, this behavior should be documented in the readme.

An option could be added to change this behavior. At first, the option could default to the current behavior and then the default behavior can be changed after a reasonable period.

This issue is related to #334. This open issue is also related, #711.

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

No branches or pull requests

1 participant