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

Error handling for File Key Provider: what is the best approach? #32

Open
mradcliffe opened this issue Aug 8, 2015 · 3 comments
Open

Comments

@mradcliffe
Copy link
Contributor

What is the best approach? Should Key throw an exception or return null? An exception would need to be handled with try/catch by modules that use Key so that the application does not crash, but leaves the possibility for an error message. Returning null is easier (?) for a module to handle, maybe?

@nerdstein
Copy link
Contributor

Which event?

When creating the key, we can do a file_exists within the validation of the plugin.

@mradcliffe
Copy link
Contributor Author

The return value is null in two cases:

  1. file does not exist
  2. for whatever reason the key provider does not have a file key method setting.

I was going to write coverage for the null return value, but was not sure if it should be changed to throwing an exception instead.

@nerdstein
Copy link
Contributor

@mradcliffe I think NULL is a good starting point at this juncture. The exception handling makes a ton of sense, but you are correct that it would need to be done within each individual module. NULL is controlled by Key. We could go as far as throw a watchdog message if no key is found. Thoughts?

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

No branches or pull requests

2 participants