Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 | 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 66820x 66820x 66820x 150x 150x 150x 150x 66670x 66820x 66820x 751x 3857x 3857x 751x 751x 751x 3857x 751x 751x 751x 751x 751x 66670x 66670x 66670x 66785x 63085x 63085x 63085x 63085x 63085x 63085x 63085x 66783x 305x 65439x 62780x 62780x 65466x 112x 112x 62973x 84x 84x 84x 66690x 66690x 66690x 66690x 66690x 3587x 3587x 63103x 63103x 63103x 66690x 63103x 63103x 84x 84x 84x 4125x 8x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 4125x 84x 84x 84x 84x 84x 84x 84x 8x 8x 8x 8x 84x 84x 9894x 9894x 9894x 9894x 84x 84x 2x 2x 2x 2x 84x 81962x 81962x 81962x 4x 4x 81958x 81958x 81962x 81962x 81962x 84x 317x 317x 317x 317x 317x 317x 1x 1x 317x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 74x 74x 74x 74x 74x 74x 74x 74x 74x 74x 74x 73x 74x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 73x 3x 73x 73x 1x 73x 73x 73x 73x 73x 73x 73x 19x 73x 73x 1x 73x 73x 73x 73x 73x 73x 74x 43x 43x 43x 43x 43x 43x 43x 43x 2x 2x 43x 43x 1x 1x 43x 43x 43x 43x 43x 73x 74x 10x 10x 10x 2x 2x 10x 10x 1x 1x 10x 10x 10x 10x 10x 74x 84x 84x 84x 84x 1x 1x 1x 1x 1x 1x 84x 84x 14731x 14731x 14731x 73x 73x 14731x 14731x 84x 311663x 311663x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 625x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 21793x 311663x 311663x 84x 84x 84x 84x 84x 84x 58092x 58092x 58092x 58092x 58092x 58092x 58092x 84x 84x 84x 319030x 319030x 319030x 319030x 319030x 14731x 319030x 304299x 304299x 319030x 319030x 6136x 7364x 6136x 6136x 319030x 319030x 84x 21870x 21870x 21870x 21870x 21870x 21870x 16827x 16827x 16827x 16827x 16827x 16827x 16827x 5043x 5043x 21870x 21870x 21870x 21870x 21870x 21870x 21870x 21870x 4496x 4496x 4496x 21870x 84x 84x 84x 5097x 5097x 5097x 5097x 84x 84x 84x 5061x 5061x 5061x 5061x 5061x 84x 84x 84x 26177x 26177x 26173x 26173x 26173x 26177x 26177x 26177x 26177x 26177x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 1607x 1607x 1607x 1607x 1607x 1607x 1572x 1572x 1572x 1607x 10x 10x 10x 1607x 1607x 1607x 1607x 1607x 1607x 1607x 1607x 1607x 1607x 1607x 1607x 1607x 4818x 1583x 1583x 3235x 3235x 1607x 1607x 1607x 1572x 1572x 1607x 10x 10x 1607x 1607x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 19x 19x 19x 19x 19x 12x 19x 3x 3x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 15x 15x 19x 19x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 2190x 2190x 2190x 2190x 2190x 2190x 2190x 2190x 2190x 2190x 2190x 2182x 2182x 2182x 2182x 2182x 2182x 2182x 2182x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 415x 415x 415x 415x 415x 415x 415x 415x 384x 415x 31x 31x 415x 3x 3x 415x 415x 415x 415x 415x 415x 415x 415x 415x 415x 415x 415x 415x 415x 386x 386x 415x 415x 84x 84x 84x 84x 84x 84x 84x 84x 84x 51x 51x 51x 51x 51x 51x 51x 51x 51x 18x 18x 18x 18x 10x 18x 8x 8x 18x 51x 51x 51x 51x 51x 51x 51x 51x 51x 51x 51x 51x 51x 49x 49x 51x 51x 84x 84x 1723x 1723x 1723x 1723x 1723x 1723x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 9x 9x 5x 5x 5x 5x 5x 5x 5x 5x 9x 9x 9x 9x 84x 84x 58x 58x 58x 58x 58x 288x 288x 58x 58x 84x 84x 84x 84x 84x 84x 84x 84x 215x 209x 209x 6x 6x 6x 6x 6x 6x 6x 84x 84x 215x 215x 215x 215x 215x 215x 215x 215x 215x 215x 213x 213x 213x 213x 213x 213x 213x 213x 213x 215x 215x 215x 215x 215x 215x 215x 215x 215x 84x 84x 84x 84x 3x 3x 3x 3x 3x 3x 3x 3x 3x 84x 84x 46x 46x 36x 36x 36x 36x 36x 309x 36x 36x 36x 36x 46x 46x 84x 84x 84x 84x 84x 84x 257x 2x 2x 255x 255x 255x 257x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 142x 142x 142x 142x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 62x 43x 43x 19x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 97x 97x 84x 84x 84x 84x 84x 84x 12x 12x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 67x 67x 39x 39x 39x 67x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 34x 34x 16x 16x 16x 16x 34x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 30x 30x 30x 30x 30x 84x 84x 1x 1x 1x 84x 84x 84x 4981x 4981x 3535x 3535x 4981x 4981x 4981x 55x 55x 4957x 4926x 4926x 4926x 4981x 4981x 4981x 4981x 4981x 4981x 4981x 8406x 8406x 8406x 4423x 8231x 3587x 3918x 396x 396x 396x 396x 8406x 4981x 4981x 4981x 4981x 1528x 1528x 7x 7x 7x 1528x 4981x 4981x 4248x 1x 1x 4248x 165x 4247x 4082x 4082x 4248x 4248x 4248x 4981x 4981x 1528x 681x 681x 681x 1521x 847x 847x 395x 395x 847x 1528x 1528x 1528x 4981x 4981x 359x 7x 7x 359x 23x 352x 329x 329x 329x 329x 359x 4981x 4981x 1148x 4927x 32x 3830x 1300x 1298x 1300x 2x 2x 2x 2x 3801x 2501x 2501x 2501x 2501x 2501x 2501x 4981x 84x 84x 1392x 1392x 2x 2x 1392x 1392x 84x 84x 84x 84x 84x 84x 84x 84x 12x 12x 6x 6x 12x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 39x 39x 84x 84x 9x 9x 84x 84x 84x 44x 44x 44x 44x 44x 44x 44x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 10x 10x 7x 10x 3x 3x 10x 10x 84x 84x 13x 13x 7x 13x 6x 6x 13x 13x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 8468x 8468x 8468x 8468x 84x 84x 84x 7x 7x 7x 7x 7x 7x 7x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 16x 16x 16x 16x 4x 4x 4x 4x 4x 4x 16x 12x 12x 16x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 56x 56x 56x 56x 56x 56x 56x 79x 79x 56x 56x 56x 34x 34x 56x 21x 21x 56x 1x 1x 1x 56x 56x 84x 84x 84x 29x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 1033x 1033x 1033x 1033x 1033x 42x 1032x 19x 19x 16x 16x 19x 991x 972x 972x 1033x 1033x 84x 84x 10x 10x 84x 84x 42x 42x 2x 40x 42x 84x 84x 84x 84x 84x 4x 4x 4x 84x 84x 84x 84x 84x 84x 4x 4x 4x 4x 1x 1x 1x 1x 1x 3x 3x 4x 4x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 230x 230x 230x 230x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 42x 42x 42x 42x 42x 42x 42x 3x 3x 42x 42x 42x 42x 84x 84x 84x 84x 55x 55x 55x 55x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 7x 7x 3x 84x 84x 84x 84x 84x 7x 7x 2x 2x 7x 84x 84x 84x 84x 84x 84x 84x 1x 1x 1x 1x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 1x 1x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 84x 7x 7x 7x 7x 7x 7x 7x 7x 84x 84x 84x 84x 84x 84x 84x | /* eslint node-core/documented-errors: "error" */ /* eslint node-core/alphabetize-errors: "error" */ /* eslint node-core/prefer-util-format-errors: "error" */ 'use strict'; // The whole point behind this internal module is to allow Node.js to no // longer be forced to treat every error message change as a semver-major // change. The NodeError classes here all expose a `code` property whose // value statically and permanently identifies the error. While the error // message may change, the code should not. const { AggregateError, ArrayFrom, ArrayIsArray, ArrayPrototypeFilter, ArrayPrototypeIncludes, ArrayPrototypeIndexOf, ArrayPrototypeJoin, ArrayPrototypeMap, ArrayPrototypePop, ArrayPrototypePush, ArrayPrototypeSlice, ArrayPrototypeSplice, ArrayPrototypeUnshift, Error, ErrorCaptureStackTrace, ErrorPrototypeToString, JSONStringify, MapPrototypeGet, MathAbs, MathMax, Number, NumberIsInteger, ObjectAssign, ObjectDefineProperty, ObjectDefineProperties, ObjectIsExtensible, ObjectGetOwnPropertyDescriptor, ObjectKeys, ObjectPrototypeHasOwnProperty, RangeError, ReflectApply, RegExpPrototypeTest, SafeArrayIterator, SafeMap, SafeWeakMap, String, StringPrototypeEndsWith, StringPrototypeIncludes, StringPrototypeMatch, StringPrototypeSlice, StringPrototypeSplit, StringPrototypeStartsWith, StringPrototypeToLowerCase, Symbol, SymbolFor, SyntaxError, TypeError, URIError, } = primordials; const kIsNodeError = Symbol('kIsNodeError'); const isWindows = process.platform === 'win32'; const messages = new SafeMap(); const codes = {}; const classRegExp = /^([A-Z][a-z0-9]*)+$/; // Sorted by a rough estimate on most frequently used entries. const kTypes = [ 'string', 'function', 'number', 'object', // Accept 'Function' and 'Object' as alternative to the lower cased version. 'Function', 'Object', 'boolean', 'bigint', 'symbol', ]; const MainContextError = Error; const overrideStackTrace = new SafeWeakMap(); const kNoOverride = Symbol('kNoOverride'); let userStackTraceLimit; const nodeInternalPrefix = '__node_internal_'; const prepareStackTrace = (globalThis, error, trace) => { // API for node internals to override error stack formatting // without interfering with userland code. if (overrideStackTrace.has(error)) { const f = overrideStackTrace.get(error); overrideStackTrace.delete(error); return f(error, trace); } const firstFrame = trace[0]?.getFunctionName(); if (firstFrame && StringPrototypeStartsWith(firstFrame, nodeInternalPrefix)) { for (let l = trace.length - 1; l >= 0; l--) { const fn = trace[l]?.getFunctionName(); if (fn && StringPrototypeStartsWith(fn, nodeInternalPrefix)) { ArrayPrototypeSplice(trace, 0, l + 1); break; } } // `userStackTraceLimit` is the user value for `Error.stackTraceLimit`, // it is updated at every new exception in `captureLargerStackTrace`. if (trace.length > userStackTraceLimit) ArrayPrototypeSplice(trace, userStackTraceLimit); } const globalOverride = maybeOverridePrepareStackTrace(globalThis, error, trace); if (globalOverride !== kNoOverride) return globalOverride; // Normal error formatting: // // Error: Message // at function (file) // at file let errorString; if (kIsNodeError in error) { errorString = `${error.name} [${error.code}]: ${error.message}`; } else { errorString = ErrorPrototypeToString(error); } if (trace.length === 0) { return errorString; } return `${errorString}\n at ${ArrayPrototypeJoin(trace, '\n at ')}`; }; const maybeOverridePrepareStackTrace = (globalThis, error, trace) => { // Polyfill of V8's Error.prepareStackTrace API. // https://crbug.com/v8/7848 // `globalThis` is the global that contains the constructor which // created `error`. if (typeof globalThis.Error?.prepareStackTrace === 'function') { return globalThis.Error.prepareStackTrace(error, trace); } // We still have legacy usage that depends on the main context's `Error` // being used, even when the error is from a different context. // TODO(devsnek): evaluate if this can be eventually deprecated/removed. if (typeof MainContextError.prepareStackTrace === 'function') { return MainContextError.prepareStackTrace(error, trace); } return kNoOverride; }; const aggregateTwoErrors = hideStackFrames((innerError, outerError) => { if (innerError && outerError && innerError !== outerError) { if (ArrayIsArray(outerError.errors)) { // If `outerError` is already an `AggregateError`. ArrayPrototypePush(outerError.errors, innerError); return outerError; } // eslint-disable-next-line no-restricted-syntax const err = new AggregateError(new SafeArrayIterator([ outerError, innerError, ]), outerError.message); err.code = outerError.code; return err; } return innerError || outerError; }); // Lazily loaded let util; let assert; let internalUtil = null; function lazyInternalUtil() { internalUtil ??= require('internal/util'); return internalUtil; } let internalUtilInspect = null; function lazyInternalUtilInspect() { internalUtilInspect ??= require('internal/util/inspect'); return internalUtilInspect; } let buffer; function lazyBuffer() { buffer ??= require('buffer').Buffer; return buffer; } function isErrorStackTraceLimitWritable() { const desc = ObjectGetOwnPropertyDescriptor(Error, 'stackTraceLimit'); if (desc === undefined) { return ObjectIsExtensible(Error); } return ObjectPrototypeHasOwnProperty(desc, 'writable') ? desc.writable : desc.set !== undefined; } function inspectWithNoCustomRetry(obj, options) { const utilInspect = lazyInternalUtilInspect(); try { return utilInspect.inspect(obj, options); } catch { return utilInspect.inspect(obj, { ...options, customInspect: false }); } } // A specialized Error that includes an additional info property with // additional information about the error condition. // It has the properties present in a UVException but with a custom error // message followed by the uv error code and uv error message. // It also has its own error code with the original uv error context put into // `err.info`. // The context passed into this error must have .code, .syscall and .message, // and may have .path and .dest. class SystemError extends Error { constructor(key, context) { const limit = Error.stackTraceLimit; if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; super(); // Reset the limit and setting the name property. if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit; const prefix = getMessage(key, [], this); let message = `${prefix}: ${context.syscall} returned ` + `${context.code} (${context.message})`; if (context.path !== undefined) message += ` ${context.path}`; if (context.dest !== undefined) message += ` => ${context.dest}`; captureLargerStackTrace(this); this.code = key; ObjectDefineProperties(this, { [kIsNodeError]: { __proto__: null, value: true, enumerable: false, writable: false, configurable: true, }, name: { __proto__: null, value: 'SystemError', enumerable: false, writable: true, configurable: true, }, message: { __proto__: null, value: message, enumerable: false, writable: true, configurable: true, }, info: { __proto__: null, value: context, enumerable: true, configurable: true, writable: false, }, errno: { __proto__: null, get() { return context.errno; }, set: (value) => { context.errno = value; }, enumerable: true, configurable: true, }, syscall: { __proto__: null, get() { return context.syscall; }, set: (value) => { context.syscall = value; }, enumerable: true, configurable: true, }, }); if (context.path !== undefined) { // TODO(BridgeAR): Investigate why and when the `.toString()` was // introduced. The `path` and `dest` properties in the context seem to // always be of type string. We should probably just remove the // `.toString()` and `Buffer.from()` operations and set the value on the // context as the user did. ObjectDefineProperty(this, 'path', { __proto__: null, get() { return context.path != null ? context.path.toString() : context.path; }, set: (value) => { context.path = value ? lazyBuffer().from(value.toString()) : undefined; }, enumerable: true, configurable: true }); } if (context.dest !== undefined) { ObjectDefineProperty(this, 'dest', { __proto__: null, get() { return context.dest != null ? context.dest.toString() : context.dest; }, set: (value) => { context.dest = value ? lazyBuffer().from(value.toString()) : undefined; }, enumerable: true, configurable: true }); } } toString() { return `${this.name} [${this.code}]: ${this.message}`; } [SymbolFor('nodejs.util.inspect.custom')](recurseTimes, ctx) { return lazyInternalUtilInspect().inspect(this, { ...ctx, getters: true, customInspect: false }); } } function makeSystemErrorWithCode(key) { return class NodeError extends SystemError { constructor(ctx) { super(key, ctx); } }; } function makeNodeErrorWithCode(Base, key) { return function NodeError(...args) { const limit = Error.stackTraceLimit; if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; const error = new Base(); // Reset the limit and setting the name property. if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit; const message = getMessage(key, args, error); ObjectDefineProperties(error, { [kIsNodeError]: { __proto__: null, value: true, enumerable: false, writable: false, configurable: true, }, message: { __proto__: null, value: message, enumerable: false, writable: true, configurable: true, }, toString: { __proto__: null, value() { return `${this.name} [${key}]: ${this.message}`; }, enumerable: false, writable: true, configurable: true, }, }); captureLargerStackTrace(error); error.code = key; return error; }; } /** * This function removes unnecessary frames from Node.js core errors. * @template {(...args: any[]) => any} T * @type {(fn: T) => T} */ function hideStackFrames(fn) { // We rename the functions that will be hidden to cut off the stacktrace // at the outermost one const hidden = nodeInternalPrefix + fn.name; ObjectDefineProperty(fn, 'name', { __proto__: null, value: hidden }); return fn; } // Utility function for registering the error codes. Only used here. Exported // *only* to allow for testing. function E(sym, val, def, ...otherClasses) { // Special case for SystemError that formats the error message differently // The SystemErrors only have SystemError as their base classes. messages.set(sym, val); if (def === SystemError) { def = makeSystemErrorWithCode(sym); } else { def = makeNodeErrorWithCode(def, sym); } if (otherClasses.length !== 0) { otherClasses.forEach((clazz) => { def[clazz.name] = makeNodeErrorWithCode(clazz, sym); }); } codes[sym] = def; } function getMessage(key, args, self) { const msg = messages.get(key); assert ??= require('internal/assert'); if (typeof msg === 'function') { assert( msg.length <= args.length, // Default options do not count. `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${msg.length}).` ); return ReflectApply(msg, self, args); } const expectedLength = (StringPrototypeMatch(msg, /%[dfijoOs]/g) || []).length; assert( expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${expectedLength}).` ); if (args.length === 0) return msg; ArrayPrototypeUnshift(args, msg); return ReflectApply(lazyInternalUtilInspect().format, null, args); } let uvBinding; function lazyUv() { uvBinding ??= internalBinding('uv'); return uvBinding; } const uvUnmappedError = ['UNKNOWN', 'unknown error']; function uvErrmapGet(name) { uvBinding = lazyUv(); uvBinding.errmap ??= uvBinding.getErrorMap(); return MapPrototypeGet(uvBinding.errmap, name); } const captureLargerStackTrace = hideStackFrames( function captureLargerStackTrace(err) { const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable(); if (stackTraceLimitIsWritable) { userStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = Infinity; } ErrorCaptureStackTrace(err); // Reset the limit if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit; return err; }); /** * This creates an error compatible with errors produced in the C++ * function UVException using a context object with data assembled in C++. * The goal is to migrate them to ERR_* errors later when compatibility is * not a concern. * * @param {object} ctx * @returns {Error} */ const uvException = hideStackFrames(function uvException(ctx) { const { 0: code, 1: uvmsg } = uvErrmapGet(ctx.errno) || uvUnmappedError; let message = `${code}: ${ctx.message || uvmsg}, ${ctx.syscall}`; let path; let dest; if (ctx.path) { path = ctx.path.toString(); message += ` '${path}'`; } if (ctx.dest) { dest = ctx.dest.toString(); message += ` -> '${dest}'`; } // Reducing the limit improves the performance significantly. We do not lose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; // Pass the message to the constructor instead of setting it on the object // to make sure it is the same as the one created in C++ // eslint-disable-next-line no-restricted-syntax const err = new Error(message); if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = tmpLimit; for (const prop of ObjectKeys(ctx)) { if (prop === 'message' || prop === 'path' || prop === 'dest') { continue; } err[prop] = ctx[prop]; } err.code = code; if (path) { err.path = path; } if (dest) { err.dest = dest; } return captureLargerStackTrace(err); }); /** * This creates an error compatible with errors produced in the C++ * This function should replace the deprecated * `exceptionWithHostPort()` function. * * @param {number} err - A libuv error number * @param {string} syscall * @param {string} address * @param {number} [port] * @returns {Error} */ const uvExceptionWithHostPort = hideStackFrames( function uvExceptionWithHostPort(err, syscall, address, port) { const { 0: code, 1: uvmsg } = uvErrmapGet(err) || uvUnmappedError; const message = `${syscall} ${code}: ${uvmsg}`; let details = ''; if (port && port > 0) { details = ` ${address}:${port}`; } else if (address) { details = ` ${address}`; } // Reducing the limit improves the performance significantly. We do not // lose the stack frames due to the `captureStackTrace()` function that // is called later. const tmpLimit = Error.stackTraceLimit; if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(`${message}${details}`); if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = tmpLimit; ex.code = code; ex.errno = err; ex.syscall = syscall; ex.address = address; if (port) { ex.port = port; } return captureLargerStackTrace(ex); }); /** * This used to be util._errnoException(). * * @param {number} err - A libuv error number * @param {string} syscall * @param {string} [original] * @returns {Error} */ const errnoException = hideStackFrames( function errnoException(err, syscall, original) { // TODO(joyeecheung): We have to use the type-checked // getSystemErrorName(err) to guard against invalid arguments from users. // This can be replaced with [ code ] = errmap.get(err) when this method // is no longer exposed to user land. util ??= require('util'); const code = util.getSystemErrorName(err); const message = original ? `${syscall} ${code} ${original}` : `${syscall} ${code}`; const tmpLimit = Error.stackTraceLimit; if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(message); if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = tmpLimit; ex.errno = err; ex.code = code; ex.syscall = syscall; return captureLargerStackTrace(ex); }); /** * Deprecated, new function is `uvExceptionWithHostPort()` * New function added the error description directly * from C++. this method for backwards compatibility * @param {number} err - A libuv error number * @param {string} syscall * @param {string} address * @param {number} [port] * @param {string} [additional] * @returns {Error} */ const exceptionWithHostPort = hideStackFrames( function exceptionWithHostPort(err, syscall, address, port, additional) { // TODO(joyeecheung): We have to use the type-checked // getSystemErrorName(err) to guard against invalid arguments from users. // This can be replaced with [ code ] = errmap.get(err) when this method // is no longer exposed to user land. util ??= require('util'); const code = util.getSystemErrorName(err); let details = ''; if (port && port > 0) { details = ` ${address}:${port}`; } else if (address) { details = ` ${address}`; } if (additional) { details += ` - Local (${additional})`; } // Reducing the limit improves the performance significantly. We do not // lose the stack frames due to the `captureStackTrace()` function that // is called later. const tmpLimit = Error.stackTraceLimit; if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(`${syscall} ${code}${details}`); if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = tmpLimit; ex.errno = err; ex.code = code; ex.syscall = syscall; ex.address = address; if (port) { ex.port = port; } return captureLargerStackTrace(ex); }); /** * @param {number|string} code - A libuv error number or a c-ares error code * @param {string} syscall * @param {string} [hostname] * @returns {Error} */ const dnsException = hideStackFrames(function(code, syscall, hostname) { let errno; // If `code` is of type number, it is a libuv error number, else it is a // c-ares error code. // TODO(joyeecheung): translate c-ares error codes into numeric ones and // make them available in a property that's not error.errno (since they // can be in conflict with libuv error codes). Also make sure // util.getSystemErrorName() can understand them when an being informed that // the number is a c-ares error code. if (typeof code === 'number') { errno = code; // ENOTFOUND is not a proper POSIX error, but this error has been in place // long enough that it's not practical to remove it. if (code === lazyUv().UV_EAI_NODATA || code === lazyUv().UV_EAI_NONAME) { code = 'ENOTFOUND'; // Fabricated error name. } else { code = lazyInternalUtil().getSystemErrorName(code); } } const message = `${syscall} ${code}${hostname ? ` ${hostname}` : ''}`; // Reducing the limit improves the performance significantly. We do not lose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(message); if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = tmpLimit; ex.errno = errno; ex.code = code; ex.syscall = syscall; if (hostname) { ex.hostname = hostname; } return captureLargerStackTrace(ex); }); function connResetException(msg) { // eslint-disable-next-line no-restricted-syntax const ex = new Error(msg); ex.code = 'ECONNRESET'; return ex; } let maxStack_ErrorName; let maxStack_ErrorMessage; /** * Returns true if `err.name` and `err.message` are equal to engine-specific * values indicating max call stack size has been exceeded. * "Maximum call stack size exceeded" in V8. * * @param {Error} err * @returns {boolean} */ function isStackOverflowError(err) { if (maxStack_ErrorMessage === undefined) { try { function overflowStack() { overflowStack(); } overflowStack(); } catch (err) { maxStack_ErrorMessage = err.message; maxStack_ErrorName = err.name; } } return err && err.name === maxStack_ErrorName && err.message === maxStack_ErrorMessage; } // Only use this for integers! Decimal numbers do not work with this function. function addNumericalSeparator(val) { let res = ''; let i = val.length; const start = val[0] === '-' ? 1 : 0; for (; i >= start + 4; i -= 3) { res = `_${StringPrototypeSlice(val, i - 3, i)}${res}`; } return `${StringPrototypeSlice(val, 0, i)}${res}`; } // Used to enhance the stack that will be picked up by the inspector const kEnhanceStackBeforeInspector = Symbol('kEnhanceStackBeforeInspector'); // These are supposed to be called only on fatal exceptions before // the process exits. const fatalExceptionStackEnhancers = { beforeInspector(error) { if (typeof error[kEnhanceStackBeforeInspector] !== 'function') { return error.stack; } try { // Set the error.stack here so it gets picked up by the // inspector. error.stack = error[kEnhanceStackBeforeInspector](); } catch { // We are just enhancing the error. If it fails, ignore it. } return error.stack; }, afterInspector(error) { const originalStack = error.stack; let useColors = true; // Some consoles do not convert ANSI escape sequences to colors, // rather display them directly to the stdout. On those consoles, // libuv emulates colors by intercepting stdout stream and calling // corresponding Windows API functions for setting console colors. // However, fatal error are handled differently and we cannot easily // highlight them. On Windows, detecting whether a console supports // ANSI escape sequences is not reliable. if (process.platform === 'win32') { const info = internalBinding('os').getOSInformation(); const ver = ArrayPrototypeMap(StringPrototypeSplit(info[2], '.'), Number); if (ver[0] !== 10 || ver[2] < 14393) { useColors = false; } } const { inspect, inspectDefaultOptions: { colors: defaultColors } } = lazyInternalUtilInspect(); const colors = useColors && ((internalBinding('util').guessHandleType(2) === 'TTY' && require('internal/tty').hasColors()) || defaultColors); try { return inspect(error, { colors, customInspect: false, depth: MathMax(inspect.defaultOptions.depth, 5) }); } catch { return originalStack; } } }; // Ensures the printed error line is from user code. let _kArrowMessagePrivateSymbol, _setHiddenValue; function setArrowMessage(err, arrowMessage) { if (!_kArrowMessagePrivateSymbol) { ({ arrow_message_private_symbol: _kArrowMessagePrivateSymbol, setHiddenValue: _setHiddenValue, } = internalBinding('util')); } _setHiddenValue(err, _kArrowMessagePrivateSymbol, arrowMessage); } // Hide stack lines before the first user code line. function hideInternalStackFrames(error) { overrideStackTrace.set(error, (error, stackFrames) => { let frames = stackFrames; if (typeof stackFrames === 'object') { frames = ArrayPrototypeFilter( stackFrames, (frm) => !StringPrototypeStartsWith(frm.getFileName() || '', 'node:internal') ); } ArrayPrototypeUnshift(frames, error); return ArrayPrototypeJoin(frames, '\n at '); }); } // Node uses an AbortError that isn't exactly the same as the DOMException // to make usage of the error in userland and readable-stream easier. // It is a regular error with `.code` and `.name`. class AbortError extends Error { constructor(message = 'The operation was aborted', options = undefined) { if (options !== undefined && typeof options !== 'object') { throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options); } super(message, options); this.code = 'ABORT_ERR'; this.name = 'AbortError'; } } /** * This creates a generic Node.js error. * * @param {string} message The error message. * @param {object} errorProperties Object with additional properties to be added to the error. * @returns {Error} */ const genericNodeError = hideStackFrames(function genericNodeError(message, errorProperties) { // eslint-disable-next-line no-restricted-syntax const err = new Error(message); ObjectAssign(err, errorProperties); return err; }); module.exports = { AbortError, aggregateTwoErrors, captureLargerStackTrace, codes, connResetException, dnsException, // This is exported only to facilitate testing. E, errnoException, exceptionWithHostPort, fatalExceptionStackEnhancers, genericNodeError, getMessage, hideInternalStackFrames, hideStackFrames, inspectWithNoCustomRetry, isErrorStackTraceLimitWritable, isStackOverflowError, kEnhanceStackBeforeInspector, kIsNodeError, kNoOverride, maybeOverridePrepareStackTrace, overrideStackTrace, prepareStackTrace, setArrowMessage, SystemError, uvErrmapGet, uvException, uvExceptionWithHostPort, }; // To declare an error message, use the E(sym, val, def) function above. The sym // must be an upper case string. The val can be either a function or a string. // The def must be an error class. // The return value of the function must be a string. // Examples: // E('EXAMPLE_KEY1', 'This is the error value', Error); // E('EXAMPLE_KEY2', (a, b) => return `${a} ${b}`, RangeError); // // Once an error code has been assigned, the code itself MUST NOT change and // any given error code must never be reused to identify a different error. // // Any error code added here should also be added to the documentation // // Note: Please try to keep these in alphabetical order // // Note: Node.js specific errors must begin with the prefix ERR_ E('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError); E('ERR_ARG_NOT_ITERABLE', '%s must be iterable', TypeError); E('ERR_ASSERTION', '%s', Error); E('ERR_ASYNC_CALLBACK', '%s must be a function', TypeError); E('ERR_ASYNC_TYPE', 'Invalid name for async "type": %s', TypeError); E('ERR_BROTLI_INVALID_PARAM', '%s is not a valid Brotli parameter', RangeError); E('ERR_BUFFER_OUT_OF_BOUNDS', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (name = undefined) => { if (name) { return `"${name}" is outside of buffer bounds`; } return 'Attempt to access memory outside buffer bounds'; }, RangeError); E('ERR_BUFFER_TOO_LARGE', 'Cannot create a Buffer larger than %s bytes', RangeError); E('ERR_CANNOT_WATCH_SIGINT', 'Cannot watch for SIGINT signals', Error); E('ERR_CHILD_CLOSED_BEFORE_REPLY', 'Child closed before reply received', Error); E('ERR_CHILD_PROCESS_IPC_REQUIRED', "Forked processes must have an IPC channel, missing value 'ipc' in %s", Error); E('ERR_CHILD_PROCESS_STDIO_MAXBUFFER', '%s maxBuffer length exceeded', RangeError); E('ERR_CONSOLE_WRITABLE_STREAM', 'Console expects a writable stream instance for %s', TypeError); E('ERR_CONTEXT_NOT_INITIALIZED', 'context used is not initialized', Error); E('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED', 'Custom engines not supported by this OpenSSL', Error); E('ERR_CRYPTO_ECDH_INVALID_FORMAT', 'Invalid ECDH format: %s', TypeError); E('ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY', 'Public key is not valid for specified curve', Error); E('ERR_CRYPTO_ENGINE_UNKNOWN', 'Engine "%s" was not found', Error); E('ERR_CRYPTO_FIPS_FORCED', 'Cannot set FIPS mode, it was forced with --force-fips at startup.', Error); E('ERR_CRYPTO_FIPS_UNAVAILABLE', 'Cannot set FIPS mode in a non-FIPS build.', Error); E('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called', Error); E('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed', Error); E('ERR_CRYPTO_INCOMPATIBLE_KEY', 'Incompatible %s: %s', Error); E('ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS', 'The selected key encoding %s %s.', Error); E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s', TypeError); E('ERR_CRYPTO_INVALID_JWK', 'Invalid JWK data', TypeError); E('ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE', 'Invalid key object type %s, expected %s.', TypeError); E('ERR_CRYPTO_INVALID_STATE', 'Invalid state for operation %s', Error); E('ERR_CRYPTO_PBKDF2_ERROR', 'PBKDF2 error', Error); E('ERR_CRYPTO_SCRYPT_INVALID_PARAMETER', 'Invalid scrypt parameter', Error); E('ERR_CRYPTO_SCRYPT_NOT_SUPPORTED', 'Scrypt algorithm not supported', Error); // Switch to TypeError. The current implementation does not seem right. E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign', Error); E('ERR_DEBUGGER_ERROR', '%s', Error); E('ERR_DEBUGGER_STARTUP_ERROR', '%s', Error); E('ERR_DIR_CLOSED', 'Directory handle was closed', Error); E('ERR_DIR_CONCURRENT_OPERATION', 'Cannot do synchronous work on directory handle with concurrent ' + 'asynchronous operations', Error); E('ERR_DNS_SET_SERVERS_FAILED', 'c-ares failed to set servers: "%s" [%s]', Error); E('ERR_DOMAIN_CALLBACK_NOT_AVAILABLE', 'A callback was registered through ' + 'process.setUncaughtExceptionCaptureCallback(), which is mutually ' + 'exclusive with using the `domain` module', Error); E('ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE', 'The `domain` module is in use, which is mutually exclusive with calling ' + 'process.setUncaughtExceptionCaptureCallback()', Error); E('ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION', 'Deserialize main function is already configured.', Error); E('ERR_ENCODING_INVALID_ENCODED_DATA', function(encoding, ret) { this.errno = ret; return `The encoded data was not valid for encoding ${encoding}`; }, TypeError); E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported', RangeError); E('ERR_EVAL_ESM_CANNOT_PRINT', '--print cannot be used with ESM input', Error); E('ERR_EVENT_RECURSION', 'The event "%s" is already being dispatched', Error); E('ERR_FALSY_VALUE_REJECTION', function(reason) { this.reason = reason; return 'Promise was rejected with falsy value'; }, Error); E('ERR_FEATURE_UNAVAILABLE_ON_PLATFORM', 'The feature %s is unavailable on the current platform' + ', which is being used to run Node.js', TypeError); E('ERR_FS_CP_DIR_TO_NON_DIR', 'Cannot overwrite directory with non-directory', SystemError); E('ERR_FS_CP_EEXIST', 'Target already exists', SystemError); E('ERR_FS_CP_EINVAL', 'Invalid src or dest', SystemError); E('ERR_FS_CP_FIFO_PIPE', 'Cannot copy a FIFO pipe', SystemError); E('ERR_FS_CP_NON_DIR_TO_DIR', 'Cannot overwrite non-directory with directory', SystemError); E('ERR_FS_CP_SOCKET', 'Cannot copy a socket file', SystemError); E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY', 'Cannot overwrite symlink in subdirectory of self', SystemError); E('ERR_FS_CP_UNKNOWN', 'Cannot copy an unknown file type', SystemError); E('ERR_FS_EISDIR', 'Path is a directory', SystemError); E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GiB', RangeError); E('ERR_FS_INVALID_SYMLINK_TYPE', 'Symlink type must be one of "dir", "file", or "junction". Received "%s"', Error); // Switch to TypeError. The current implementation does not seem right E('ERR_HTTP2_ALTSVC_INVALID_ORIGIN', 'HTTP/2 ALTSVC frames require a valid origin', TypeError); E('ERR_HTTP2_ALTSVC_LENGTH', 'HTTP/2 ALTSVC frames are limited to 16382 bytes', TypeError); E('ERR_HTTP2_CONNECT_AUTHORITY', ':authority header is required for CONNECT requests', Error); E('ERR_HTTP2_CONNECT_PATH', 'The :path header is forbidden for CONNECT requests', Error); E('ERR_HTTP2_CONNECT_SCHEME', 'The :scheme header is forbidden for CONNECT requests', Error); E('ERR_HTTP2_GOAWAY_SESSION', 'New streams cannot be created after receiving a GOAWAY', Error); E('ERR_HTTP2_HEADERS_AFTER_RESPOND', 'Cannot specify additional headers after response initiated', Error); E('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.', Error); E('ERR_HTTP2_HEADER_SINGLE_VALUE', 'Header field "%s" must only have a single value', TypeError); E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED', 'Informational status codes cannot be used', RangeError); E('ERR_HTTP2_INVALID_CONNECTION_HEADERS', 'HTTP/1 Connection specific headers are forbidden: "%s"', TypeError); E('ERR_HTTP2_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"', TypeError); E('ERR_HTTP2_INVALID_INFO_STATUS', 'Invalid informational status code: %s', RangeError); E('ERR_HTTP2_INVALID_ORIGIN', 'HTTP/2 ORIGIN frames require a valid origin', TypeError); E('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH', 'Packed settings length must be a multiple of six', RangeError); E('ERR_HTTP2_INVALID_PSEUDOHEADER', '"%s" is an invalid pseudoheader or is used incorrectly', TypeError); E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed', Error); E('ERR_HTTP2_INVALID_SETTING_VALUE', // Using default arguments here is important so the arguments are not counted // towards `Function#length`. function(name, actual, min = undefined, max = undefined) { this.actual = actual; if (min !== undefined) { this.min = min; this.max = max; } return `Invalid value for setting "${name}": ${actual}`; }, TypeError, RangeError); E('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed', Error); E('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', 'Maximum number of pending settings acknowledgements', Error); E('ERR_HTTP2_NESTED_PUSH', 'A push stream cannot initiate another push stream.', Error); E('ERR_HTTP2_NO_MEM', 'Out of memory', Error); E('ERR_HTTP2_NO_SOCKET_MANIPULATION', 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)', Error); E('ERR_HTTP2_ORIGIN_LENGTH', 'HTTP/2 ORIGIN frames are limited to 16382 bytes', TypeError); E('ERR_HTTP2_OUT_OF_STREAMS', 'No stream ID is available because maximum stream ID has been reached', Error); E('ERR_HTTP2_PAYLOAD_FORBIDDEN', 'Responses with %s status must not have a payload', Error); E('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled', Error); E('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes', RangeError); E('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED', 'Cannot set HTTP/2 pseudo-headers', TypeError); E('ERR_HTTP2_PUSH_DISABLED', 'HTTP/2 client has disabled push streams', Error); E('ERR_HTTP2_SEND_FILE', 'Directories cannot be sent', Error); E('ERR_HTTP2_SEND_FILE_NOSEEK', 'Offset or length can only be specified for regular files', Error); E('ERR_HTTP2_SESSION_ERROR', 'Session closed with error code %s', Error); E('ERR_HTTP2_SETTINGS_CANCEL', 'HTTP2 session settings canceled', Error); E('ERR_HTTP2_SOCKET_BOUND', 'The socket is already bound to an Http2Session', Error); E('ERR_HTTP2_SOCKET_UNBOUND', 'The socket has been disconnected from the Http2Session', Error); E('ERR_HTTP2_STATUS_101', 'HTTP status code 101 (Switching Protocols) is forbidden in HTTP/2', Error); E('ERR_HTTP2_STATUS_INVALID', 'Invalid status code: %s', RangeError); E('ERR_HTTP2_STREAM_CANCEL', function(error) { let msg = 'The pending stream has been canceled'; if (error) { this.cause = error; if (typeof error.message === 'string') msg += ` (caused by: ${error.message})`; } return msg; }, Error); E('ERR_HTTP2_STREAM_ERROR', 'Stream closed with error code %s', Error); E('ERR_HTTP2_STREAM_SELF_DEPENDENCY', 'A stream cannot depend on itself', Error); E('ERR_HTTP2_TOO_MANY_INVALID_FRAMES', 'Too many invalid HTTP/2 frames', Error); E('ERR_HTTP2_TRAILERS_ALREADY_SENT', 'Trailing headers have already been sent', Error); E('ERR_HTTP2_TRAILERS_NOT_READY', 'Trailing headers cannot be sent until after the wantTrailers event is ' + 'emitted', Error); E('ERR_HTTP2_UNSUPPORTED_PROTOCOL', 'protocol "%s" is unsupported.', Error); E('ERR_HTTP_HEADERS_SENT', 'Cannot %s headers after they are sent to the client', Error); E('ERR_HTTP_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"', TypeError); E('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s', RangeError); E('ERR_HTTP_REQUEST_TIMEOUT', 'Request timeout', Error); E('ERR_HTTP_SOCKET_ENCODING', 'Changing the socket encoding is not allowed per RFC7230 Section 3.', Error); E('ERR_HTTP_TRAILER_INVALID', 'Trailers are invalid with this transfer encoding', Error); E('ERR_ILLEGAL_CONSTRUCTOR', 'Illegal constructor', TypeError); E('ERR_IMPORT_ASSERTION_TYPE_FAILED', 'Module "%s" is not of type "%s"', TypeError); E('ERR_IMPORT_ASSERTION_TYPE_MISSING', 'Module "%s" needs an import assertion of type "%s"', TypeError); E('ERR_IMPORT_ASSERTION_TYPE_UNSUPPORTED', 'Import assertion type "%s" is unsupported', TypeError); E('ERR_INCOMPATIBLE_OPTION_PAIR', 'Option "%s" cannot be used in combination with option "%s"', TypeError); E('ERR_INPUT_TYPE_NOT_ALLOWED', '--input-type can only be used with string ' + 'input via --eval, --print, or STDIN', Error); E('ERR_INSPECTOR_ALREADY_ACTIVATED', 'Inspector is already activated. Close it with inspector.close() ' + 'before activating it again.', Error); E('ERR_INSPECTOR_ALREADY_CONNECTED', '%s is already connected', Error); E('ERR_INSPECTOR_CLOSED', 'Session was closed', Error); E('ERR_INSPECTOR_COMMAND', 'Inspector error %d: %s', Error); E('ERR_INSPECTOR_NOT_ACTIVE', 'Inspector is not active', Error); E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available', Error); E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected', Error); E('ERR_INSPECTOR_NOT_WORKER', 'Current thread is not a worker', Error); E('ERR_INTERNAL_ASSERTION', (message) => { const suffix = 'This is caused by either a bug in Node.js ' + 'or incorrect usage of Node.js internals.\n' + 'Please open an issue with this stack trace at ' + 'https://github.com/nodejs/node/issues\n'; return message === undefined ? suffix : `${message}\n${suffix}`; }, Error); E('ERR_INVALID_ADDRESS_FAMILY', function(addressType, host, port) { this.host = host; this.port = port; return `Invalid address family: ${addressType} ${host}:${port}`; }, RangeError); E('ERR_INVALID_ARG_TYPE', (name, expected, actual) => { assert(typeof name === 'string', "'name' must be a string"); if (!ArrayIsArray(expected)) { expected = [expected]; } let msg = 'The '; if (StringPrototypeEndsWith(name, ' argument')) { // For cases like 'first argument' msg += `${name} `; } else { const type = StringPrototypeIncludes(name, '.') ? 'property' : 'argument'; msg += `"${name}" ${type} `; } msg += 'must be '; const types = []; const instances = []; const other = []; for (const value of expected) { assert(typeof value === 'string', 'All expected entries have to be of type string'); if (ArrayPrototypeIncludes(kTypes, value)) { ArrayPrototypePush(types, StringPrototypeToLowerCase(value)); } else if (RegExpPrototypeTest(classRegExp, value)) { ArrayPrototypePush(instances, value); } else { assert(value !== 'object', 'The value "object" should be written as "Object"'); ArrayPrototypePush(other, value); } } // Special handle `object` in case other instances are allowed to outline // the differences between each other. if (instances.length > 0) { const pos = ArrayPrototypeIndexOf(types, 'object'); if (pos !== -1) { ArrayPrototypeSplice(types, pos, 1); ArrayPrototypePush(instances, 'Object'); } } if (types.length > 0) { if (types.length > 2) { const last = ArrayPrototypePop(types); msg += `one of type ${ArrayPrototypeJoin(types, ', ')}, or ${last}`; } else if (types.length === 2) { msg += `one of type ${types[0]} or ${types[1]}`; } else { msg += `of type ${types[0]}`; } if (instances.length > 0 || other.length > 0) msg += ' or '; } if (instances.length > 0) { if (instances.length > 2) { const last = ArrayPrototypePop(instances); msg += `an instance of ${ArrayPrototypeJoin(instances, ', ')}, or ${last}`; } else { msg += `an instance of ${instances[0]}`; if (instances.length === 2) { msg += ` or ${instances[1]}`; } } if (other.length > 0) msg += ' or '; } if (other.length > 0) { if (other.length > 2) { const last = ArrayPrototypePop(other); msg += `one of ${ArrayPrototypeJoin(other, ', ')}, or ${last}`; } else if (other.length === 2) { msg += `one of ${other[0]} or ${other[1]}`; } else { if (StringPrototypeToLowerCase(other[0]) !== other[0]) msg += 'an '; msg += `${other[0]}`; } } if (actual == null) { msg += `. Received ${actual}`; } else if (typeof actual === 'function' && actual.name) { msg += `. Received function ${actual.name}`; } else if (typeof actual === 'object') { if (actual.constructor?.name) { msg += `. Received an instance of ${actual.constructor.name}`; } else { const inspected = lazyInternalUtilInspect() .inspect(actual, { depth: -1 }); msg += `. Received ${inspected}`; } } else { let inspected = lazyInternalUtilInspect() .inspect(actual, { colors: false }); if (inspected.length > 25) inspected = `${StringPrototypeSlice(inspected, 0, 25)}...`; msg += `. Received type ${typeof actual} (${inspected})`; } return msg; }, TypeError); E('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => { let inspected = lazyInternalUtilInspect().inspect(value); if (inspected.length > 128) { inspected = `${StringPrototypeSlice(inspected, 0, 128)}...`; } const type = StringPrototypeIncludes(name, '.') ? 'property' : 'argument'; return `The ${type} '${name}' ${reason}. Received ${inspected}`; }, TypeError, RangeError); E('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s', RangeError); E('ERR_INVALID_BUFFER_SIZE', 'Buffer size must be a multiple of %s', RangeError); E('ERR_INVALID_CHAR', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (name, field = undefined) => { let msg = `Invalid character in ${name}`; if (field !== undefined) { msg += ` ["${field}"]`; } return msg; }, TypeError); E('ERR_INVALID_CURSOR_POS', 'Cannot set cursor row without setting its column', TypeError); E('ERR_INVALID_FD', '"fd" must be a positive integer: %s', RangeError); E('ERR_INVALID_FD_TYPE', 'Unsupported fd type: %s', TypeError); E('ERR_INVALID_FILE_URL_HOST', 'File URL host must be "localhost" or empty on %s', TypeError); E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s', TypeError); E('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent', TypeError); E('ERR_INVALID_HTTP_TOKEN', '%s must be a valid HTTP token ["%s"]', TypeError); E('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s', TypeError); E('ERR_INVALID_MODULE_SPECIFIER', (request, reason, base = undefined) => { return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ''}`; }, TypeError); E('ERR_INVALID_PACKAGE_CONFIG', (path, base, message) => { return `Invalid package config ${path}${base ? ` while importing ${base}` : ''}${message ? `. ${message}` : ''}`; }, Error); E('ERR_INVALID_PACKAGE_TARGET', (pkgPath, key, target, isImport = false, base = undefined) => { const relError = typeof target === 'string' && !isImport && target.length && !StringPrototypeStartsWith(target, './'); if (key === '.') { assert(isImport === false); return `Invalid "exports" main target ${JSONStringify(target)} defined ` + `in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ''}${relError ? '; targets must start with "./"' : ''}`; } return `Invalid "${isImport ? 'imports' : 'exports'}" target ${ JSONStringify(target)} defined for '${key}' in the package config ${ pkgPath}package.json${base ? ` imported from ${base}` : ''}${relError ? '; targets must start with "./"' : ''}`; }, Error); E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"', TypeError); E('ERR_INVALID_REPL_EVAL_CONFIG', 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', TypeError); E('ERR_INVALID_REPL_INPUT', '%s', TypeError); E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => { return `Expected a valid ${input} to be returned for the "${prop}" from the` + ` "${name}" function but got ${value}.`; }, TypeError); E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => { let type; if (value && value.constructor && value.constructor.name) { type = `instance of ${value.constructor.name}`; } else { type = `type ${typeof value}`; } return `Expected ${input} to be returned for the "${prop}" from the` + ` "${name}" function but got ${type}.`; }, TypeError); E('ERR_INVALID_RETURN_VALUE', (input, name, value) => { let type; if (value?.constructor?.name) { type = `instance of ${value.constructor.name}`; } else { type = `type ${typeof value}`; } return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.`; }, TypeError, RangeError); E('ERR_INVALID_STATE', 'Invalid state: %s', Error, TypeError, RangeError); E('ERR_INVALID_SYNC_FORK_INPUT', 'Asynchronous forks do not support ' + 'Buffer, TypedArray, DataView or string input: %s', TypeError); E('ERR_INVALID_THIS', 'Value of "this" must be of type %s', TypeError); E('ERR_INVALID_TUPLE', '%s must be an iterable %s tuple', TypeError); E('ERR_INVALID_URI', 'URI malformed', URIError); E('ERR_INVALID_URL', function(input) { this.input = input; // Don't include URL in message. // (See https://github.com/nodejs/node/pull/38614) return 'Invalid URL'; }, TypeError); E('ERR_INVALID_URL_SCHEME', (expected) => { if (typeof expected === 'string') expected = [expected]; assert(expected.length <= 2); const res = expected.length === 2 ? `one of scheme ${expected[0]} or ${expected[1]}` : `of scheme ${expected[0]}`; return `The URL must be ${res}`; }, TypeError); E('ERR_IPC_CHANNEL_CLOSED', 'Channel closed', Error); E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected', Error); E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe', Error); E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks', Error); E( 'ERR_LOADER_CHAIN_INCOMPLETE', '"%s" did not call the next hook in its chain and did not' + ' explicitly signal a short circuit. If this is intentional, include' + ' `shortCircuit: true` in the hook\'s return.', Error ); E('ERR_MANIFEST_ASSERT_INTEGRITY', (moduleURL, realIntegrities) => { let msg = `The content of "${ moduleURL }" does not match the expected integrity.`; if (realIntegrities.size) { const sri = ArrayPrototypeJoin( ArrayFrom(realIntegrities.entries(), ({ 0: alg, 1: dgs }) => `${alg}-${dgs}`), ' ' ); msg += ` Integrities found are: ${sri}`; } else { msg += ' The resource was not found in the policy.'; } return msg; }, Error); E('ERR_MANIFEST_DEPENDENCY_MISSING', 'Manifest resource %s does not list %s as a dependency specifier for ' + 'conditions: %s', Error); E('ERR_MANIFEST_INTEGRITY_MISMATCH', 'Manifest resource %s has multiple entries but integrity lists do not match', SyntaxError); E('ERR_MANIFEST_INVALID_RESOURCE_FIELD', 'Manifest resource %s has invalid property value for %s', TypeError); E('ERR_MANIFEST_INVALID_SPECIFIER', 'Manifest resource %s has invalid dependency mapping %s', TypeError); E('ERR_MANIFEST_TDZ', 'Manifest initialization has not yet run', Error); E('ERR_MANIFEST_UNKNOWN_ONERROR', 'Manifest specified unknown error behavior "%s".', SyntaxError); E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error); E('ERR_MISSING_ARGS', (...args) => { assert(args.length > 0, 'At least one arg needs to be specified'); let msg = 'The '; const len = args.length; const wrap = (a) => `"${a}"`; args = ArrayPrototypeMap( args, (a) => (ArrayIsArray(a) ? ArrayPrototypeJoin(ArrayPrototypeMap(a, wrap), ' or ') : wrap(a)) ); switch (len) { case 1: msg += `${args[0]} argument`; break; case 2: msg += `${args[0]} and ${args[1]} arguments`; break; default: msg += ArrayPrototypeJoin(ArrayPrototypeSlice(args, 0, len - 1), ', '); msg += `, and ${args[len - 1]} arguments`; break; } return `${msg} must be specified`; }, TypeError); E('ERR_MISSING_OPTION', '%s is required', TypeError); E('ERR_MODULE_NOT_FOUND', (path, base, type = 'package') => { return `Cannot find ${type} '${path}' imported from ${base}`; }, Error); E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error); E('ERR_NAPI_CONS_FUNCTION', 'Constructor must be a function', TypeError); E('ERR_NAPI_INVALID_DATAVIEW_ARGS', 'byte_offset + byte_length should be less than or equal to the size in ' + 'bytes of the array passed in', RangeError); E('ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT', 'start offset of %s should be a multiple of %s', RangeError); E('ERR_NAPI_INVALID_TYPEDARRAY_LENGTH', 'Invalid typed array length', RangeError); E('ERR_NETWORK_IMPORT_BAD_RESPONSE', "import '%s' received a bad response: %s", Error); E('ERR_NETWORK_IMPORT_DISALLOWED', "import of '%s' by %s is not supported: %s", Error); E('ERR_NOT_BUILDING_SNAPSHOT', 'Operation cannot be invoked when not building startup snapshot', Error); E('ERR_NO_CRYPTO', 'Node.js is not compiled with OpenSSL crypto support', Error); E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU', TypeError); E('ERR_OPERATION_FAILED', 'Operation failed: %s', Error, TypeError); E('ERR_OUT_OF_RANGE', (str, range, input, replaceDefaultBoolean = false) => { assert(range, 'Missing "range" argument'); let msg = replaceDefaultBoolean ? str : `The value of "${str}" is out of range.`; let received; if (NumberIsInteger(input) && MathAbs(input) > 2 ** 32) { received = addNumericalSeparator(String(input)); } else if (typeof input === 'bigint') { received = String(input); if (input > 2n ** 32n || input < -(2n ** 32n)) { received = addNumericalSeparator(received); } received += 'n'; } else { received = lazyInternalUtilInspect().inspect(input); } msg += ` It must be ${range}. Received ${received}`; return msg; }, RangeError); E('ERR_PACKAGE_IMPORT_NOT_DEFINED', (specifier, packagePath, base) => { return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ''} imported from ${base}`; }, TypeError); E('ERR_PACKAGE_PATH_NOT_EXPORTED', (pkgPath, subpath, base = undefined) => { if (subpath === '.') return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ''}`; return `Package subpath '${subpath}' is not defined by "exports" in ${ pkgPath}package.json${base ? ` imported from ${base}` : ''}`; }, Error); E('ERR_PARSE_ARGS_INVALID_OPTION_VALUE', '%s', TypeError); E('ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL', "Unexpected argument '%s'. This " + 'command does not take positional arguments', TypeError); E('ERR_PARSE_ARGS_UNKNOWN_OPTION', (option, allowPositionals) => { const suggestDashDash = allowPositionals ? '. To specify a positional ' + "argument starting with a '-', place it at the end of the command after " + `'--', as in '-- ${JSONStringify(option)}` : ''; return `Unknown option '${option}'${suggestDashDash}`; }, TypeError); E('ERR_PERFORMANCE_INVALID_TIMESTAMP', '%d is not a valid timestamp', TypeError); E('ERR_PERFORMANCE_MEASURE_INVALID_OPTIONS', '%s', TypeError); E('ERR_REQUIRE_ESM', function(filename, hasEsmSyntax, parentPath = null, packageJsonPath = null) { hideInternalStackFrames(this); let msg = `require() of ES Module ${filename}${parentPath ? ` from ${ parentPath}` : ''} not supported.`; if (!packageJsonPath) { if (StringPrototypeEndsWith(filename, '.mjs')) msg += `\nInstead change the require of ${filename} to a dynamic ` + 'import() which is available in all CommonJS modules.'; return msg; } const path = require('path'); const basename = parentPath && path.basename(filename) === path.basename(parentPath) ? filename : path.basename(filename); if (hasEsmSyntax) { msg += `\nInstead change the require of ${basename} in ${parentPath} to` + ' a dynamic import() which is available in all CommonJS modules.'; return msg; } msg += `\n${basename} is treated as an ES module file as it is a .js ` + 'file whose nearest parent package.json contains "type": "module" ' + 'which declares all .js files in that package scope as ES modules.' + `\nInstead rename ${basename} to end in .cjs, change the requiring ` + 'code to use dynamic import() which is available in all CommonJS ' + 'modules, or change "type": "module" to "type": "commonjs" in ' + `${packageJsonPath} to treat all .js files as CommonJS (using .mjs for ` + 'all ES modules instead).\n'; return msg; }, Error); E('ERR_SCRIPT_EXECUTION_INTERRUPTED', 'Script execution was interrupted by `SIGINT`', Error); E('ERR_SERVER_ALREADY_LISTEN', 'Listen method has been called more than once without closing.', Error); E('ERR_SERVER_NOT_RUNNING', 'Server is not running.', Error); E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound', Error); E('ERR_SOCKET_BAD_BUFFER_SIZE', 'Buffer size must be a positive integer', TypeError); E('ERR_SOCKET_BAD_PORT', (name, port, allowZero = true) => { assert(typeof allowZero === 'boolean', "The 'allowZero' argument must be of type boolean."); const operator = allowZero ? '>=' : '>'; return `${name} should be ${operator} 0 and < 65536. Received ${port}.`; }, RangeError); E('ERR_SOCKET_BAD_TYPE', 'Bad socket type specified. Valid types are: udp4, udp6', TypeError); E('ERR_SOCKET_BUFFER_SIZE', 'Could not get or set buffer size', SystemError); E('ERR_SOCKET_CLOSED', 'Socket is closed', Error); E('ERR_SOCKET_DGRAM_IS_CONNECTED', 'Already connected', Error); E('ERR_SOCKET_DGRAM_NOT_CONNECTED', 'Not connected', Error); E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running', Error); E('ERR_SRI_PARSE', 'Subresource Integrity string %j had an unexpected %j at position %d', SyntaxError); E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error); E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error); E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error); E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error); E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error); E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error); E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error); E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error); E('ERR_SYNTHETIC', 'JavaScript Callstack', Error); E('ERR_SYSTEM_ERROR', 'A system error occurred', SystemError); E('ERR_TEST_FAILURE', function(error, failureType) { hideInternalStackFrames(this); assert(typeof failureType === 'string', "The 'failureType' argument must be of type string."); let msg = error?.message ?? error; if (typeof msg !== 'string') { msg = inspectWithNoCustomRetry(msg); } this.failureType = failureType; this.cause = error; return msg; }, Error); E('ERR_TLS_CERT_ALTNAME_FORMAT', 'Invalid subject alternative name string', SyntaxError); E('ERR_TLS_CERT_ALTNAME_INVALID', function(reason, host, cert) { this.reason = reason; this.host = host; this.cert = cert; return `Hostname/IP does not match certificate's altnames: ${reason}`; }, Error); E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error); E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error); E('ERR_TLS_INVALID_CONTEXT', '%s must be a SecureContext', TypeError); E('ERR_TLS_INVALID_PROTOCOL_VERSION', '%j is not a valid %s TLS protocol version', TypeError); E('ERR_TLS_INVALID_STATE', 'TLS socket connection must be securely established', Error); E('ERR_TLS_PROTOCOL_VERSION_CONFLICT', 'TLS protocol version %j conflicts with secureProtocol %j', TypeError); E('ERR_TLS_RENEGOTIATION_DISABLED', 'TLS session renegotiation disabled for this socket', Error); // This should probably be a `TypeError`. E('ERR_TLS_REQUIRED_SERVER_NAME', '"servername" is required parameter for Server.addContext', Error); E('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected', Error); E('ERR_TLS_SNI_FROM_SERVER', 'Cannot issue SNI from a TLS server-side socket', Error); E('ERR_TRACE_EVENTS_CATEGORY_REQUIRED', 'At least one category is required', TypeError); E('ERR_TRACE_EVENTS_UNAVAILABLE', 'Trace events are unavailable', Error); // This should probably be a `RangeError`. E('ERR_TTY_INIT_FAILED', 'TTY initialization failed', SystemError); E('ERR_UNAVAILABLE_DURING_EXIT', 'Cannot call function in process exit ' + 'handler', Error); E('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET', '`process.setupUncaughtExceptionCapture()` was called while a capture ' + 'callback was already active', Error); E('ERR_UNESCAPED_CHARACTERS', '%s contains unescaped characters', TypeError); E('ERR_UNHANDLED_ERROR', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (err = undefined) => { const msg = 'Unhandled error.'; if (err === undefined) return msg; return `${msg} (${err})`; }, Error); E('ERR_UNKNOWN_BUILTIN_MODULE', 'No such built-in module: %s', Error); E('ERR_UNKNOWN_CREDENTIAL', '%s identifier does not exist: %s', Error); E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError); E('ERR_UNKNOWN_FILE_EXTENSION', (ext, path, suggestion) => { let msg = `Unknown file extension "${ext}" for ${path}`; if (suggestion) { msg += `. ${suggestion}`; } return msg; }, TypeError); E('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s for URL %s', RangeError); E('ERR_UNKNOWN_SIGNAL', 'Unknown signal: %s', TypeError); E('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " + 'resolving ES modules imported from %s', Error); E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url, supported) => { let msg = `Only URLs with a scheme in: ${ArrayPrototypeJoin(supported, ', ')} are supported by the default ESM loader`; if (isWindows && url.protocol.length === 2) { msg += '. On Windows, absolute paths must be valid file:// URLs'; } msg += `. Received protocol '${url.protocol}'`; return msg; }, Error); E('ERR_USE_AFTER_CLOSE', '%s was closed', Error); // This should probably be a `TypeError`. E('ERR_VALID_PERFORMANCE_ENTRY_TYPE', 'At least one valid performance entry type is required', Error); E('ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING', 'A dynamic import callback was not specified.', TypeError); E('ERR_VM_MODULE_ALREADY_LINKED', 'Module has already been linked', Error); E('ERR_VM_MODULE_CANNOT_CREATE_CACHED_DATA', 'Cached data cannot be created for a module which has been evaluated', Error); E('ERR_VM_MODULE_DIFFERENT_CONTEXT', 'Linked modules must use the same context', Error); E('ERR_VM_MODULE_LINK_FAILURE', function(message, cause) { this.cause = cause; return message; }, Error); E('ERR_VM_MODULE_NOT_MODULE', 'Provided module is not an instance of Module', Error); E('ERR_VM_MODULE_STATUS', 'Module status %s', Error); E('ERR_WASI_ALREADY_STARTED', 'WASI instance has already started', Error); E('ERR_WEBASSEMBLY_RESPONSE', 'WebAssembly response %s', TypeError); E('ERR_WORKER_INIT_FAILED', 'Worker initialization failure: %s', Error); E('ERR_WORKER_INVALID_EXEC_ARGV', (errors, msg = 'invalid execArgv flags') => `Initiated Worker with ${msg}: ${ArrayPrototypeJoin(errors, ', ')}`, Error); E('ERR_WORKER_NOT_RUNNING', 'Worker instance not running', Error); E('ERR_WORKER_OUT_OF_MEMORY', 'Worker terminated due to reaching memory limit: %s', Error); E('ERR_WORKER_PATH', (filename) => 'The worker script or module filename must be an absolute path or a ' + 'relative path starting with \'./\' or \'../\'.' + (StringPrototypeStartsWith(filename, 'file://') ? ' Wrap file:// URLs with `new URL`.' : '' ) + (StringPrototypeStartsWith(filename, 'data:text/javascript') ? ' Wrap data: URLs with `new URL`.' : '' ) + ` Received "${filename}"`, TypeError); E('ERR_WORKER_UNSERIALIZABLE_ERROR', 'Serializing an uncaught exception failed', Error); E('ERR_WORKER_UNSUPPORTED_OPERATION', '%s is not supported in workers', TypeError); E('ERR_ZLIB_INITIALIZATION_FAILED', 'Initialization failed', Error); |