Skip to content

Commit

Permalink
example.lua: handle some error
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
  • Loading branch information
Jianhui Zhao committed Apr 27, 2019
1 parent 2b10244 commit 1e7b81b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion example/example.lua
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ local function start_reconnect()
end

do_connect = function()
local c = umqtt.connect({
local c, err = umqtt.connect({
host = 'localhost',
port = 1883,
ssl = false,
Expand All @@ -54,6 +54,11 @@ do_connect = function()
retain = true
}
})

if not c then
print(loop:now(), err)
return
end

-- sp: session persistent
-- code: return code
Expand Down

0 comments on commit 1e7b81b

Please sign in to comment.