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

Suggestion: Descriptive error message #309

Closed
LordKriegan opened this issue Nov 16, 2023 · 2 comments · Fixed by #310
Closed

Suggestion: Descriptive error message #309

LordKriegan opened this issue Nov 16, 2023 · 2 comments · Fixed by #310

Comments

@LordKriegan
Copy link

LordKriegan commented Nov 16, 2023

Hi! I have a mongoose schema that I had added a virtual to translate a cron expression into a human-readable string using your package. Initially, I had just set virtuals to true at the schema level. That did lead to an error in one method where I was excluding my cron interval field (which the virtual translates from). It took me a good hour to figure that out however, as the error message you output only says
"Expression is empty"
May I suggest that you should add some extra verbage on where the error is coming from and why? For example:
"cRonstrue Error: Expression passed to <method> is empty"
or something to that effect. That way at least we know where the error is coming from.

@bradymholt
Copy link
Owner

Are you suggesting that the error message itself contain the name of the package "cRonstrue"? If so, I'd rather not hardcode the package name in the error messages as the package name might change at some point in the future. It sounds like you may be able to add some additional logging info in your system to pinpoint the source of an error.

@LordKriegan
Copy link
Author

dont need to hardcode the package name. im assuming you have a config file somewhere or you can import your package.json and pull the name of the package from there. Don't even need the package name; that was just an example. Im just saying that "Expression is empty" was a frustratingly vague error message that provided no context as to where it was coming from.

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 a pull request may close this issue.

2 participants