@@ -244,13 +244,7 @@ void After(uv_fs_t *req) {
244
244
req_wrap->encoding_ ,
245
245
&error);
246
246
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;
254
248
} else {
255
249
argv[1 ] = link .ToLocalChecked ();
256
250
}
@@ -263,13 +257,7 @@ void After(uv_fs_t *req) {
263
257
req_wrap->encoding_ ,
264
258
&error);
265
259
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;
273
261
} else {
274
262
argv[1 ] = link .ToLocalChecked ();
275
263
}
@@ -281,13 +269,7 @@ void After(uv_fs_t *req) {
281
269
req_wrap->encoding_ ,
282
270
&error);
283
271
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;
291
273
} else {
292
274
argv[1 ] = link .ToLocalChecked ();
293
275
}
@@ -326,13 +308,7 @@ void After(uv_fs_t *req) {
326
308
req_wrap->encoding_ ,
327
309
&error);
328
310
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;
336
312
break ;
337
313
}
338
314
name_argv[name_idx++] = filename.ToLocalChecked ();
@@ -711,11 +687,8 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
711
687
encoding,
712
688
&error);
713
689
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 ;
719
692
}
720
693
args.GetReturnValue ().Set (rc.ToLocalChecked ());
721
694
}
@@ -886,11 +859,8 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {
886
859
encoding,
887
860
&error);
888
861
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 ;
894
864
}
895
865
args.GetReturnValue ().Set (rc.ToLocalChecked ());
896
866
}
@@ -940,11 +910,8 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
940
910
encoding,
941
911
&error);
942
912
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 ;
948
915
}
949
916
950
917
name_v[name_idx++] = filename.ToLocalChecked ();
@@ -1405,11 +1372,8 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
1405
1372
MaybeLocal<Value> rc =
1406
1373
StringBytes::Encode (env->isolate (), path, encoding, &error);
1407
1374
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 ;
1413
1377
}
1414
1378
args.GetReturnValue ().Set (rc.ToLocalChecked ());
1415
1379
}
0 commit comments