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

Support for error codes #42

Open
KaiJan57 opened this issue Jul 4, 2022 · 2 comments
Open

Support for error codes #42

KaiJan57 opened this issue Jul 4, 2022 · 2 comments

Comments

@KaiJan57
Copy link

KaiJan57 commented Jul 4, 2022

As far as I can tell, git-credential-keepassxc always returns error 0 or 1, regardless of what exactly went wrong. For scriptiing purposes it would be really cool if e.g. no unlocked database was indicated by a different error code from no entry found errors, such that the script can take proper action… I'm not very fluent in rust, but I think it should be really easy to implement for great value, isn't it? :)

@Frederick888
Copy link
Owner

It's actually not that easy... I use https://github.com/dtolnay/anyhow for error handling which is specifically designed for use cases such as CLI tools, where you don't care about what went wrong, just care about whether it went wrong.

Is there a particular use case you can't work around without this atm? Or is this more of a 'nice to have' you have in mind?

@KaiJan57
Copy link
Author

KaiJan57 commented Jul 6, 2022

Okay so my issue is kind of an XY type: I want to make sure that the database is unlocked when I retrieve passwords from within isync I use for my email, so my sync script would need to detect that the failure was caused by the fact that no database is unlocked, and that would enable it to not start isync in the first place (I dont want it to run with locked database because it wastes resources and creates a pop up for each failed login, prompting me to type in the password).
In the end I worked around this issue by creating a test entry that is guaranteed to be available, so if that request fails, my script knows that the database is locked and it does not invoke isync.
I know, if it really is that bad to implement, I think we might consider this issue a 'nice to have' and focus on other matters (close this issue if you think alike), but if you find a good opportunity to implement different error codes, I would be happy to avoid that dirty hack ;)
Anyhow, thanks for considering my request and have a nice day :)

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

No branches or pull requests

2 participants