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

[Question] How do you handle NotFound, Conflict, and Forbidden when editing resources? #41

Open
ChristopherHaws opened this issue Aug 11, 2020 · 1 comment

Comments

@ChristopherHaws
Copy link

ChristopherHaws commented Aug 11, 2020

I'm curious how you would handle some common, real world scenarios using command handlers:

  • The resource cannot be found (i.e. If the course could not be found here)
  • The resource has a concurrency token and they don't match when trying to update (which should turn into a 409 Conflict HTTP status code)
  • The user trying to edit a specific resource does not have permission to do so using resource based auth. It seems like the Controller/PageModel should be in charge of handling auth, but then you would have to lookup the resource in the Controller/PageModel to run auth on it and look it up again in the command handler.
@jbogard
Copy link
Owner

jbogard commented Aug 13, 2020

Typically I still handle all of this at the controller level. If there is something at the handler level that can return that response, I use that instead, and decorate the response with the additional information.

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