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

Improve error message on labels #633

Merged
merged 6 commits into from
Jun 22, 2024

Conversation

leftieFriele
Copy link
Contributor

This fix ensures consumers of the library get more insights into which labels are causing an error to occur.

With the new error message it is easier for a developer to debug what happened in the case where you accidentally pass in a bad argument.

If getLabels gets called like this:

getLabels(['label1', 'label2'], ['arg1']);

it used to throw...

Error: Invalid number of arguments
    at exports.getLabels 

now it throws this:

Error: Invalid number of arguments: "arg1" for label names: "label1,label2".
    at exports.getLabels 

Copy link
Collaborator

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

thanks! just a quick suggestion, happy to merge after that 🙂

lib/util.js Outdated Show resolved Hide resolved
Co-authored-by: Simen Bekkhus <[email protected]>
@leftieFriele
Copy link
Contributor Author

thanks! just a quick suggestion, happy to merge after that 🙂

👍 I didn't squash it on the branch, so squash and merge. thanks for the quick reply ❤️

@SimenB SimenB merged commit bd45211 into siimon:master Jun 22, 2024
14 checks passed
@stalet
Copy link

stalet commented Jun 25, 2024

When is this scheduled to be released ?

@SimenB
Copy link
Collaborator

SimenB commented Jun 26, 2024

I'm currently away at a festival, but I can make a release on Sunday (unless @zbjornson gets to it before me)

@SimenB
Copy link
Collaborator

SimenB commented Jun 27, 2024

had some time this morning, so published in https://github.com/siimon/prom-client/releases/tag/v15.1.3

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