stephencelis / ghi

GitHub Issues on the command line. Use your $EDITOR, not your browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can we provide a nice error message for a connection issue

martinmosegaard opened this issue · comments

Scenario: I lost Internet access without noticing and then ran a ghi command. The output was a Ruby exception saying that SSL connect failed. Could we wrap this in error handling and just print a more human-readable message?

Current output looks like this:

/usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock': SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (OpenSSL::SSL::SSLError)
	from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/net/http.rb:933:in `connect'
	from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
	from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/net/http.rb:852:in `start'
	from /usr/local/lib/ruby/gems/2.3.0/gems/ghi-1.2.0/lib/ghi/client.rb:131:in `request'
	from /usr/local/lib/ruby/gems/2.3.0/gems/ghi-1.2.0/lib/ghi/client.rb:80:in `post'
	from /usr/local/lib/ruby/gems/2.3.0/gems/ghi-1.2.0/lib/ghi/commands/open.rb:85:in `block in execute'
	from /usr/local/lib/ruby/gems/2.3.0/gems/ghi-1.2.0/lib/ghi/formatting.rb:509:in `throb'
	from /usr/local/lib/ruby/gems/2.3.0/gems/ghi-1.2.0/lib/ghi/commands/open.rb:85:in `execute'
	from /usr/local/lib/ruby/gems/2.3.0/gems/ghi-1.2.0/lib/ghi/commands/command.rb:17:in `execute'
	from /usr/local/lib/ruby/gems/2.3.0/gems/ghi-1.2.0/lib/ghi.rb:80:in `execute'
	from /usr/local/lib/ruby/gems/2.3.0/gems/ghi-1.2.0/bin/ghi:4:in `<top (required)>'
	from /usr/local/bin/ghi:23:in `load'
	from /usr/local/bin/ghi:23:in `<main>'

(Btw, what is this error actually about? Old versions of Ruby? Missing config? Suggested solution?)

I experienced data loss as a result of a network connection issue:
First I typed ghi open at the command line, which caused vim to open so that an issue could be typed up. After spending some time on the message, I typed :wq to quit vim, at which point I got an network connectivity error, with no way to recover the message that I had spent time typing in vim.

It would be nice if, in case of network failure, ghi could echo the message to the command line. This way the message could be recovered if necessary.