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

Provide option for parse error handler command prepending #4

Closed
Radiergummi opened this issue Nov 29, 2017 · 4 comments
Closed

Provide option for parse error handler command prepending #4

Radiergummi opened this issue Nov 29, 2017 · 4 comments

Comments

@Radiergummi
Copy link

Currently, the command line is prepended to the error message in src/index.js L332-L340:

.catch(err => {
            // jsdoc err might not be very useful when some arguments are
            // invalid. so, we'll prepend the full command, in case of an
            // error and re-throw.
            const cmd = 'jsdoc ' + args.join(' ');
            err.message = err.message + ' \nExecuted JSDoc Command: ' + cmd + '\n'
                + 'with JSON configuration: ' + JSON.stringify(conf || {});
            throw err;
        })

Would it be possible to provide an option to turn this off? That's more of a debugging issue 😊

@onury
Copy link
Owner

onury commented Nov 29, 2017

Sure but what's your use case? If you don't want it to throw, you'd still catch it. So you want to see the error but not the extra information in the message?

@Radiergummi
Copy link
Author

I'm working on a documentation framework called Phoenix that splits reading, parsing and writing in separate steps, basically. I need all parser error messages in a digestible format, so the command line is simply not relevant there. Currently, I'm using error.message.replace( /Executed JSDoc Command: [\s\S]*/, '' ), but I'm a little uncomfortable with a hard coded string in there that might change.

@onury
Copy link
Owner

onury commented Nov 29, 2017

Alright. Added in v2.0.1
Let me know if this works for you.

@onury onury closed this as completed Nov 29, 2017
@Radiergummi
Copy link
Author

This is perfect, thank you. I'll make sure to credit you and this project in the README 😊

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

No branches or pull requests

2 participants