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

Custom errors for collection2 #87

Closed
geekyme opened this issue Jul 14, 2014 · 5 comments
Closed

Custom errors for collection2 #87

geekyme opened this issue Jul 14, 2014 · 5 comments

Comments

@geekyme
Copy link

geekyme commented Jul 14, 2014

Hello,

If I want to throw my own errors, it seems that I need to specify allow / deny rules on the server side only so they do not interfere with simple-schema.

Is this behavior supposed to be correct? I read on http://stackoverflow.com/questions/20375913/where-should-i-put-allow-and-deny-rules-in-meteor-js that there are benefits with placing allow / deny rules on the client side to save on round trips to the server.

@aldeed
Copy link
Collaborator

aldeed commented Jul 14, 2014

Are you sure it is true that allow/deny can't be defined on the client? Validation should be happening before the insert/update is attempted, and therefore before allow/deny are checked. Can you post a repo that shows the issue clearly?

@geekyme
Copy link
Author

geekyme commented Jul 14, 2014

let me try to make a repo. it works for you?

@aldeed
Copy link
Collaborator

aldeed commented Jul 14, 2014

I don't have time to test at the moment, but I usually put allow/deny in common code, and I've never had an issue. But it's possible you have a certain circumstance that is slightly different for some reason.

@geekyme
Copy link
Author

geekyme commented Jul 14, 2014

i think i made a mistake @aldeed sorry for ringing the alarm. After creating a sample leaderboard app with the same mechanisms in place, it appears the custom errors are working even though my allow / deny are in common code.

https://github.com/geekyme/leaderboard-c2-custom-errors

appears to be working - http://shawn.meteor.com/

:S I have to try to find out why my own app code is failing to do this.

@geekyme geekyme closed this as completed Jul 14, 2014
@geekyme geekyme changed the title Custom errors require allow/deny to be defined on the server only Custom errors for collection2 Jul 14, 2014
@aldeed
Copy link
Collaborator

aldeed commented Jul 14, 2014

OK, if you haven't already set SimpleSchema.debug = true, that maybe can help.

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

No branches or pull requests

2 participants