ruanyl / vim-gh-line

vim plugin that open the link of current line on github
MIT License
408 stars 37 forks source link

Improve error messages in case remote is not recognized #25

Closed ahakanbaba closed 5 years ago

ahakanbaba commented 5 years ago

If the remote is not recognized, vim prints these messages. They are not very useful.

Error detected while processing function <SNR>36_gh_line:
line   44:
E121: Undefined variable: url
E15: Invalid expression: g:gh_open_command . url
line   46:
E121: Undefined variable: l:finalCmd
E15: Invalid expression: "vim-gh-line executing: " . l:finalCmd
line   48:
E121: Undefined variable: l:finalCmd
E116: Invalid arguments for function system
Press ENTER or type command to continue

This is because the final else {} condition is missing in this if - else chain. https://github.com/ruanyl/vim-gh-line/blob/5f2bd335133a942b868bacd59cddc4fb488c86ee/plugin/vim-gh-line.vim#L93

We should add an else condition and give a reasonable error message to the user. For example The remote: <remote> has not been recognized as one of the supported git hosing frameworks: GitHub, GitLab, BitBucket, Cgit.