Skip to content

Comments

Add ability to customize response in case of error by passing callable object #15

Open
ysv wants to merge 6 commits intoeparreno:masterfrom
ysv:feature/custom-errors
Open

Add ability to customize response in case of error by passing callable object #15
ysv wants to merge 6 commits intoeparreno:masterfrom
ysv:feature/custom-errors

Conversation

@ysv
Copy link

@ysv ysv commented Oct 17, 2019

We are willing to use your gem in our stack but faced one limitation.
It's impossible to customize error messages because they are hardcoded in Rack::JWT::Auth#return_error.

Since we have convention of error response in our stack I would like to introduce feature for customizing error messages by passing on_error option into middleware initializer

@ysv ysv changed the title Feature for customization error message in response [WIP] Feature for customization error message in response Oct 17, 2019
@ysv ysv changed the title [WIP] Feature for customization error message in response Add ability to customize response in case of error by passing callable object Oct 17, 2019
@ysv
Copy link
Author

ysv commented Oct 17, 2019

@eparreno could you take a look please

MissingAuthHeader => 'Missing Authorization header',
InvalidAuthHeaderFormat => 'Invalid Authorization header format'
}
message = error_message.fetch(error.class, 'Default')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove Default here

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

Successfully merging this pull request may close these issues.

1 participant