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

plug to ensure load_resource actually worked #238

Merged
merged 1 commit into from
Dec 22, 2016

Conversation

ericsullivan
Copy link
Contributor

When I first used Guardian it was strange that current_resource could be nil after calling the LoadResource plug. It still seems to be an issue. I decided to go for 3 pull requests and add it.

The discussion suggested using a new plug or updating LoadResource. I used a new plug because I didn't want to change LoadResources current behavior, but it could have gone either way, maybe with the plug looking like this:

plug Guardian.Plug.LoadResource, call_handler: true #assumes Guardian.Plug.ErrorHandler
plug Guardian.Plug.LoadResource, handler: MyApp.MyAuthErrorHandler

I'm not sure about the default return code or message. I also didn't know if it should call one of the existing error handler methods, but I figured leaving it explicit gives users of the plug the most flexibility. The code / specs / documentation was just copied and a few variables changed, so thanks for the great base to work in.

@doomspork
Copy link
Member

Thank you @ericsullivan, I'll review this today and leave feedback 👍

@doomspork
Copy link
Member

Thank you again @ericsullivan 👍

@doomspork doomspork merged commit 824e2a4 into ueberauth:master Dec 22, 2016
@ericsullivan ericsullivan deleted the ensure_resource branch December 23, 2016 00:50
Hanspagh pushed a commit to Hanspagh/guardian that referenced this pull request Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants