feat: return error from internet.open
This commit is contained in:
parent
970c2fa1f3
commit
f9b8ecf600
4
mqtt.lua
4
mqtt.lua
|
@ -29,9 +29,9 @@ end
|
|||
local MqttClient = {}
|
||||
|
||||
function mqtt.open (address, port)
|
||||
local conn = require("internet").open(address, port)
|
||||
local conn, err = require("internet").open(address, port)
|
||||
if conn == nil then
|
||||
return nil, "connection failed"
|
||||
return nil, err
|
||||
end
|
||||
|
||||
return MqttClient:new(conn), nil
|
||||
|
|
Loading…
Reference in New Issue