handle tinydtls error code and spit lua errors
enhance error management