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

Delete the name of collections in error messages #422

Closed
Saeeed-B opened this issue Sep 27, 2020 · 5 comments · Fixed by #426
Closed

Delete the name of collections in error messages #422

Saeeed-B opened this issue Sep 27, 2020 · 5 comments · Fixed by #426

Comments

@Saeeed-B
Copy link

Saeeed-B commented Sep 27, 2020

When errors are returned (If the input information is incorrect) , The name of the corresponding collection is also in the error message . LIKE this :

name is required in CollectionName insert

i want this part (in CollectionName insert ) gone.

error messages belong to software users, and users do not need to see the name of the collection.
And this part should not be returned at all.

And this is about this line:

https://github.com/Meteor-Community-Packages/meteor-collection2/blob/master/package/collection2/collection2.js#L479

I also raised this issue in the simpl-schema, but it is not related to simpl-schema.

For more details, please refer to the following links:

longshotlabs/simpl-schema#408

https://forums.meteor.com/t/delete-the-name-of-collections-in-error-messages-in-simpl-schema/54073/18

@StorytellerCZ
Copy link
Member

Probably good to leave for development and get rid of it in production.

@copleykj
Copy link
Member

I'm not sure this is an issue.. These error messages should never be seen by the user. Errors should be caught, handled in application code, and custom error messages propagated to the UI.

@StorytellerCZ
Copy link
Member

That might be so, but with Meteor it is easy to do error.message in method callback and just return that, so it is probably too common (I'm guilty of this as well). But if your error handling depends on string parsing with the collection name then this would be a breaking change...

@Saeeed-B
Copy link
Author

@copleykj @StorytellerCZ
This is exactly the problem, we can easily show the exact error to the user, and more importantly, this error is in any language we want.
And when we show these messages to the user, there is no need for many additional validations.
Please look at the error system in Laravel, they take the user field and if it does not match any of the credentials, they show the message corresponding to the same credential.
If we can make the validation only in the collection is great, because it no longer matters where the input comes from, in any case it must have the necessary validity.
Also, if it is not valid, a very accurate message will be displayed.
I hope I was able to get it right, because I do not speak English very well

@StorytellerCZ
Copy link
Member

I think the compromise might be that on production the collection name will be hidden while we leave it as is for development.

StorytellerCZ added a commit to StorytellerCZ/meteor-collection2 that referenced this issue Apr 21, 2021
StorytellerCZ added a commit that referenced this issue Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants