Skip to content

Commit 1cd21b4

Browse files
committed
esp32/modsocket: Raise an exception if socket.connect did not succeed.
1 parent fc7f2bd commit 1cd21b4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

esp32/modsocket.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ STATIC mp_obj_t socket_connect(const mp_obj_t arg0, const mp_obj_t arg1) {
151151
_socket_getaddrinfo(arg1, &res);
152152
int r = lwip_connect(self->fd, res->ai_addr, res->ai_addrlen);
153153
lwip_freeaddrinfo(res);
154-
return mp_obj_new_int(r);
154+
if (r != 0) {
155+
exception_from_errno(errno);
156+
}
157+
return mp_const_none;
155158
}
156159
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
157160

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy