handle lookup errors when connecting
Connect may result in lookup error, which was not handled. Solve this by use a default error handler which returns whatever mosquitto reports.
This prevents us from missing errors.
Given that we still have some of the error codes enumerated, would it perhaps make more sense to leave the others that were enumerated, and just add a default case, perhaps with a "warning, missing enums in library handling!" ?
The idea was to only handle the special cases:
- success
- errno
- errors that should raise a lua error
And then just returns the error number with the mosquitto_strerror as default.
This helps us to deal with undocumented errors (like no connection) and future errors.
I dont think we need a warning for it.
One question though, I don't know we we should raise a lua error by default or return the error number.
Given that we still have some of the error codes enumerated, would it perhaps make more sense to leave the others that were enumerated, and just add a default case, perhaps with a "warning, missing enums in library handling!" ?
Rebased it to do this, but I have no idea how to do the warning.
@karlp can you please have another look?