Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

adding error when key is missing #260

Conversation

renatamarques97
Copy link
Contributor

resolves #212

@andrerpbts let me know how to deal with multiple rails versions

@andrerpbts
Copy link
Collaborator

andrerpbts commented May 4, 2020

I think we don't need to deal with multiple rails versions because it's only the fallback that we automaticaly set and Knock users can change it in the config/knock.rb file into their own applications. Then, I think the solution provided here, won't work if an user sets an empty string in that file... Can you confirm it, please?

My suggestion is to transform the mattr_accessor into mattr_writer + a class getter method, that will handle empty strings to raise that error. I would leave it raise NoMethodError in older versions were Rails.application.secrets doesn't exist, and user can fix that changing for the more appropriated value...

Also, I suggest to create a specific error class for that empty string exception as well...

Last, please, add some test to that 👍

@renatamarques97
Copy link
Contributor Author

Thanks for clarifying me

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No error raised when key is missing
2 participants