Created
April 3, 2015 03:01
-
-
Save kennuzzo/fcd1ab47726f34f3ca8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include 'doorkeeper_helpers' in doorkeeper intializer | |
# raise Doorkeeper::Errors::InvalidResourceOwner | |
# remember to add the error message translation to the doorkeeper locale yaml. | |
# in lib/doorkeeper/helpers/doorkeeper_helpers.rb | |
module Doorkeeper | |
module Helpers::Controller | |
alias_method :old, :get_error_response_from_exception | |
def get_error_response_from_exception(exception) | |
error_name = case exception | |
when Errors::InvalidResourceOwner | |
:invalid_resource_owner | |
end | |
if error_name | |
OAuth::ErrorResponse.new name: error_name, state: params[:state] | |
else | |
old exception | |
end | |
end | |
end | |
module Errors | |
class InvalidResourceOwner < DoorkeeperError; end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment