diff --git a/src/socket.js.c b/src/socket.js.c index a520d1a1..6cccccf1 100644 --- a/src/socket.js.c +++ b/src/socket.js.c @@ -899,8 +899,7 @@ int _socket_writeInternal(socket_t* socket, promiseid_t promise, const char* dat { if (!socket->_socket.data) { - tf_task_reject_promise(socket->_task, promise, JS_ThrowInternalError(tf_task_get_context(socket->_task), "uv_write: %s", "not connected")); - return -1; + return UV_ENOTCONN; } char* rawBuffer = tf_malloc(sizeof(uv_write_t) + length); @@ -917,7 +916,6 @@ int _socket_writeInternal(socket_t* socket, promiseid_t promise, const char* dat int result = uv_write(request, (uv_stream_t*)&socket->_socket, &buffer, 1, _socket_onWrite); if (result != 0) { - tf_task_reject_promise(socket->_task, promise, JS_ThrowInternalError(tf_task_get_context(socket->_task), "uv_write: %s", uv_strerror(result))); tf_free(rawBuffer); } return result;