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

use user-error to signal errors #45

Open
wbolster opened this issue Jul 26, 2017 · 3 comments
Open

use user-error to signal errors #45

wbolster opened this issue Jul 26, 2017 · 3 comments
Milestone

Comments

@wbolster
Copy link

first, thanks for this package!

that said, please use (user-error ...) instead or (message ...) to signal errors, so that i can catch them and do something sensible.

this would allow me to write a function that would first try (git-link-commit), falling back to (git-link) in case that fails, which would basically "do what i mean" in 99% of my use cases.

let me know whether i should submit a pr!

@sshaw
Copy link
Owner

sshaw commented Jul 26, 2017

Hi, I only call error in git-link-homepage. messages is most everywhere.

Can you provide more info? Thanks!

@wbolster
Copy link
Author

yeah, my suggestion is to use (user-error) instead of (message) when something goes wrong. right now you use (message) which does not trigger an error that can be caught.

i want to be able to do something like this:

    (condition-case nil
        (git-link-commit)
      (user-error
       (git-link)))

but it seems right now i cannot.

@sshaw
Copy link
Owner

sshaw commented Jul 27, 2017

Got it, makes sense. I'll have to look into user-error.

You may also want to checkout the PRs and issues. There's talk of making a git-link-dwim function or maybe even changing git-link to fallback to git-link-commit.

I think changing these functions to signal errors will require releasing a 1.0 version.

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