@@ -244,13 +244,7 @@ void After(uv_fs_t *req) {
244244 req_wrap->encoding_ ,
245245 &error);
246246 if (link.IsEmpty ()) {
247- // TODO(addaleax): Use `error` itself here.
248- argv[0 ] = UVException (env->isolate (),
249- UV_EINVAL,
250- req_wrap->syscall (),
251- " Invalid character encoding for filename" ,
252- req->path ,
253- req_wrap->data ());
247+ argv[0 ] = error;
254248 } else {
255249 argv[1 ] = link.ToLocalChecked ();
256250 }
@@ -263,13 +257,7 @@ void After(uv_fs_t *req) {
263257 req_wrap->encoding_ ,
264258 &error);
265259 if (link.IsEmpty ()) {
266- // TODO(addaleax): Use `error` itself here.
267- argv[0 ] = UVException (env->isolate (),
268- UV_EINVAL,
269- req_wrap->syscall (),
270- " Invalid character encoding for link" ,
271- req->path ,
272- req_wrap->data ());
260+ argv[0 ] = error;
273261 } else {
274262 argv[1 ] = link.ToLocalChecked ();
275263 }
@@ -281,13 +269,7 @@ void After(uv_fs_t *req) {
281269 req_wrap->encoding_ ,
282270 &error);
283271 if (link.IsEmpty ()) {
284- // TODO(addaleax): Use `error` itself here.
285- argv[0 ] = UVException (env->isolate (),
286- UV_EINVAL,
287- req_wrap->syscall (),
288- " Invalid character encoding for link" ,
289- req->path ,
290- req_wrap->data ());
272+ argv[0 ] = error;
291273 } else {
292274 argv[1 ] = link.ToLocalChecked ();
293275 }
@@ -326,13 +308,7 @@ void After(uv_fs_t *req) {
326308 req_wrap->encoding_ ,
327309 &error);
328310 if (filename.IsEmpty ()) {
329- // TODO(addaleax): Use `error` itself here.
330- argv[0 ] = UVException (env->isolate (),
331- UV_EINVAL,
332- req_wrap->syscall (),
333- " Invalid character encoding for filename" ,
334- req->path ,
335- req_wrap->data ());
311+ argv[0 ] = error;
336312 break ;
337313 }
338314 name_argv[name_idx++] = filename.ToLocalChecked ();
@@ -711,11 +687,8 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
711687 encoding,
712688 &error);
713689 if (rc.IsEmpty ()) {
714- // TODO(addaleax): Use `error` itself here.
715- return env->ThrowUVException (UV_EINVAL,
716- " readlink" ,
717- " Invalid character encoding for link" ,
718- *path);
690+ env->isolate ()->ThrowException (error);
691+ return ;
719692 }
720693 args.GetReturnValue ().Set (rc.ToLocalChecked ());
721694 }
@@ -886,11 +859,8 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {
886859 encoding,
887860 &error);
888861 if (rc.IsEmpty ()) {
889- // TODO(addaleax): Use `error` itself here.
890- return env->ThrowUVException (UV_EINVAL,
891- " realpath" ,
892- " Invalid character encoding for path" ,
893- *path);
862+ env->isolate ()->ThrowException (error);
863+ return ;
894864 }
895865 args.GetReturnValue ().Set (rc.ToLocalChecked ());
896866 }
@@ -940,11 +910,8 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
940910 encoding,
941911 &error);
942912 if (filename.IsEmpty ()) {
943- // TODO(addaleax): Use `error` itself here.
944- return env->ThrowUVException (UV_EINVAL,
945- " readdir" ,
946- " Invalid character encoding for filename" ,
947- *path);
913+ env->isolate ()->ThrowException (error);
914+ return ;
948915 }
949916
950917 name_v[name_idx++] = filename.ToLocalChecked ();
@@ -1405,11 +1372,8 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
14051372 MaybeLocal<Value> rc =
14061373 StringBytes::Encode (env->isolate (), path, encoding, &error);
14071374 if (rc.IsEmpty ()) {
1408- // TODO(addaleax): Use `error` itself here.
1409- return env->ThrowUVException (UV_EINVAL,
1410- " mkdtemp" ,
1411- " Invalid character encoding for filename" ,
1412- *tmpl);
1375+ env->isolate ()->ThrowException (error);
1376+ return ;
14131377 }
14141378 args.GetReturnValue ().Set (rc.ToLocalChecked ());
14151379 }
0 commit comments