| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7e54424 commit 784c6d4
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -376,27 +376,11 @@ static void GetUserInfo(const FunctionCallbackInfo<Value>& args) { | |||
| 376 | 376 | else | |
| 377 | 377 | shell = StringBytes::Encode(env->isolate(), pwd.shell, encoding, &error); | |
| 378 | 378 | ||
| 379 | - uv_os_free_passwd(&pwd); | ||
| 380 | - | ||
| 381 | - if (username.IsEmpty()) { | ||
| 382 | - // TODO(addaleax): Use `error` itself here. | ||
| 383 | - return env->ThrowUVException(UV_EINVAL, | ||
| 384 | - "uv_os_get_passwd", | ||
| 385 | - "Invalid character encoding for username"); | ||
| 386 | - } | ||
| 387 | - | ||
| 388 | - if (homedir.IsEmpty()) { | ||
| 389 | - // TODO(addaleax): Use `error` itself here. | ||
| 390 | - return env->ThrowUVException(UV_EINVAL, | ||
| 391 | - "uv_os_get_passwd", | ||
| 392 | - "Invalid character encoding for homedir"); | ||
| 393 | - } | ||
| 394 | - | ||
| 395 | - if (shell.IsEmpty()) { | ||
| 396 | - // TODO(addaleax): Use `error` itself here. | ||
| 397 | - return env->ThrowUVException(UV_EINVAL, | ||
| 398 | - "uv_os_get_passwd", | ||
| 399 | - "Invalid character encoding for shell"); | ||
| 379 | + if (username.IsEmpty() || homedir.IsEmpty() || shell.IsEmpty()) { | ||
| 380 | + CHECK(!error.IsEmpty()); | ||
| 381 | + uv_os_free_passwd(&pwd); | ||
| 382 | + env->isolate()->ThrowException(error); | ||
| 383 | + return; | ||
| 400 | 384 | } | |
| 401 | 385 | ||
| 402 | 386 | Local<Object> entry = Object::New(env->isolate()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -686,7 +686,6 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate, | |||
| 686 | 686 | CHECK_NE(encoding, UCS2); | |
| 687 | 687 | CHECK_BUFLEN_IN_RANGE(buflen); | |
| 688 | 688 | ||
| 689 | - *error = Local<Value>(); | ||
| 690 | 689 | if (!buflen && encoding != BUFFER) { | |
| 691 | 690 | return String::Empty(isolate); | |
| 692 | 691 | } | |
@@ -772,7 +771,6 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate, | |||
| 772 | 771 | size_t buflen, | |
| 773 | 772 | Local<Value>* error) { | |
| 774 | 773 | CHECK_BUFLEN_IN_RANGE(buflen); | |
| 775 | - *error = Local<Value>(); | ||
| 776 | 774 | ||
| 777 | 775 | // Node's "ucs2" encoding expects LE character data inside a | |
| 778 | 776 | // Buffer, so we need to reorder on BE platforms. See | |
| Back | FazBrowse Home | New Git URL |
0 commit comments