gemini: better error-handling
This commit is contained in:
parent
04a062e94d
commit
e9d72de48b
14
gemini.tlv
14
gemini.tlv
|
@ -469,16 +469,20 @@
|
||||||
> options = 'all',
|
> options = 'all',
|
||||||
> }
|
> }
|
||||||
> local conn = socket.tcp()
|
> local conn = socket.tcp()
|
||||||
> conn:connect(parsed_url.host, parsed_url.port or 1965)
|
> local conn2, err = conn:connect(parsed_url.host, parsed_url.port or 1965)
|
||||||
|
> clear(state.lines)
|
||||||
|
> state.highlight_index = 0 -- highlighted link not computed yet
|
||||||
|
> if conn2 == nil then
|
||||||
|
> table.insert(state.lines, err)
|
||||||
|
> return
|
||||||
|
> end
|
||||||
> conn, err = ssl.wrap(conn, params)
|
> conn, err = ssl.wrap(conn, params)
|
||||||
> if conn == nil then
|
> if conn == nil then
|
||||||
> io.write(err)
|
> table.insert(state.lines, err)
|
||||||
> os.exit(1)
|
> return
|
||||||
> end
|
> end
|
||||||
> conn:dohandshake()
|
> conn:dohandshake()
|
||||||
> conn:send(url .. "\r\n")
|
> conn:send(url .. "\r\n")
|
||||||
> clear(state.lines)
|
|
||||||
> state.highlight_index = 0 -- highlighted link not computed yet
|
|
||||||
> local line, err = conn:receive()
|
> local line, err = conn:receive()
|
||||||
> if line == nil then
|
> if line == nil then
|
||||||
> table.insert(state.lines, err)
|
> table.insert(state.lines, err)
|
||||||
|
|
Loading…
Reference in New Issue