@flex-development/errnode
Advanced tools
Comparing version 1.5.0 to 2.0.0
169
CHANGELOG.md
@@ -0,1 +1,170 @@ | ||
## [2.0.0](https://github.com/flex-development/errnode/compare/1.5.0...2.0.0) (2023-07-29) | ||
### ⚠ BREAKING CHANGES | ||
* **utils:** [`createNodeError`] use class expression pattern | ||
* **nvm:** require `>=16.20.0` | ||
### :package: Build | ||
* **deps-dev:** Bump @commitlint/cli from 17.4.2 to 17.4.4 ([#94](https://github.com/flex-development/errnode/issues/94)) ([cd56ae1](https://github.com/flex-development/errnode/commit/cd56ae1c1c615fa4d389850c62b7349c05b102df)) | ||
* **deps-dev:** Bump @commitlint/cli from 17.5.1 to 17.6.1 ([#156](https://github.com/flex-development/errnode/issues/156)) ([6680773](https://github.com/flex-development/errnode/commit/6680773aa02132ad98ff51f3246013b0638ccddc)) | ||
* **deps-dev:** Bump @commitlint/cli from 17.6.1 to 17.6.3 ([#183](https://github.com/flex-development/errnode/issues/183)) ([288eff2](https://github.com/flex-development/errnode/commit/288eff29f2c3407e0e87a4996a437bac6d544a88)) | ||
* **deps-dev:** Bump @commitlint/cli from 17.6.3 to 17.6.7 ([#252](https://github.com/flex-development/errnode/issues/252)) ([61225db](https://github.com/flex-development/errnode/commit/61225dbd8c5ef5a64fd740466ab81a510ccebb39)) | ||
* **deps-dev:** Bump @commitlint/config-conventional from 17.4.2 to 17.4.4 ([#91](https://github.com/flex-development/errnode/issues/91)) ([4bb1a7c](https://github.com/flex-development/errnode/commit/4bb1a7c2d9191a5165252ecdb223a5606dd96a0f)) | ||
* **deps-dev:** Bump @faker-js/faker from 8.0.0 to 8.0.1 ([#214](https://github.com/flex-development/errnode/issues/214)) ([6019cfa](https://github.com/flex-development/errnode/commit/6019cfa5386fd08ff4a9df6e163e4c76e8dcf2f5)) | ||
* **deps-dev:** Bump @faker-js/faker from 8.0.0-alpha.2 to 8.0.0-beta.0 ([#176](https://github.com/flex-development/errnode/issues/176)) ([97a1b84](https://github.com/flex-development/errnode/commit/97a1b84a458d927f418ceafb0fb2ec5a3b92381f)) | ||
* **deps-dev:** Bump @faker-js/faker from 8.0.0-beta.0 to 8.0.0-beta.1 ([#192](https://github.com/flex-development/errnode/issues/192)) ([0a2c31c](https://github.com/flex-development/errnode/commit/0a2c31cf94beb709fe57c80476d3f017a3774297)) | ||
* **deps-dev:** Bump @faker-js/faker from 8.0.0-beta.1 to 8.0.0 ([#201](https://github.com/flex-development/errnode/issues/201)) ([d1a551c](https://github.com/flex-development/errnode/commit/d1a551c85de33c19b2d32c80a786046bfdc9c8bf)) | ||
* **deps-dev:** Bump @flex-development/esm-types from 1.0.0 to 2.0.0 ([#253](https://github.com/flex-development/errnode/issues/253)) ([851f107](https://github.com/flex-development/errnode/commit/851f1072f3d1b69782ee72580f2d8d151881d3f7)) | ||
* **deps-dev:** bump @flex-development/mkbuild from 1.0.0-alpha.11 to 1.0.0-alpha.13 ([5bb3f28](https://github.com/flex-development/errnode/commit/5bb3f28d1ef6e1db252ed9144e7a12bdd52cb4c0)) | ||
* **deps-dev:** bump @flex-development/mkbuild from 1.0.0-alpha.9 to 1.0.0-alpha.11 ([49e4a34](https://github.com/flex-development/errnode/commit/49e4a34ca024bc3565b01a9082ca191bdeb436e0)) | ||
* **deps-dev:** bump @flex-development/mlly from 1.0.0-alpha.9 to 1.0.0-alpha.11 ([7280845](https://github.com/flex-development/errnode/commit/72808450f47d6dd2444c93fb22778dd7695d3767)) | ||
* **deps-dev:** Bump @flex-development/pkg-types from 2.0.0 to 3.0.0 ([#255](https://github.com/flex-development/errnode/issues/255)) ([f0ca875](https://github.com/flex-development/errnode/commit/f0ca8754c46e64b639ede0b487c2a8f73ad0c6c0)) | ||
* **deps-dev:** Bump @graphql-eslint/eslint-plugin from 3.15.0 to 3.16.0 ([#80](https://github.com/flex-development/errnode/issues/80)) ([f711ee5](https://github.com/flex-development/errnode/commit/f711ee5c23cc4991e1cfd17927c7d338fabd7aab)) | ||
* **deps-dev:** Bump @graphql-eslint/eslint-plugin from 3.18.0 to 3.19.1 ([#218](https://github.com/flex-development/errnode/issues/218)) ([ceb1ec7](https://github.com/flex-development/errnode/commit/ceb1ec738a19194ca9c94ec73d61d26ff784ac28)) | ||
* **deps-dev:** Bump @types/eslint from 8.21.0 to 8.21.1 ([#89](https://github.com/flex-development/errnode/issues/89)) ([3634d79](https://github.com/flex-development/errnode/commit/3634d79fde30172e8c99a29f748af086a38d84d8)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.49.0 to 5.50.0 ([#48](https://github.com/flex-development/errnode/issues/48)) ([a48e72d](https://github.com/flex-development/errnode/commit/a48e72d8620bfdce604ef3abbaff9e6d5c3d10b3)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.50.0 to 5.51.0 ([#64](https://github.com/flex-development/errnode/issues/64)) ([c2a168b](https://github.com/flex-development/errnode/commit/c2a168b37cfcb7221adcce69ae6b41009c88c71a)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.51.0 to 5.52.0 ([#93](https://github.com/flex-development/errnode/issues/93)) ([01ebe5c](https://github.com/flex-development/errnode/commit/01ebe5c806f4a8fc05bbd05413e75721fa474c48)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.52.0 to 5.53.0 ([#96](https://github.com/flex-development/errnode/issues/96)) ([30d897b](https://github.com/flex-development/errnode/commit/30d897bc16b60ca7fb917ce103022d3ff9774f52)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.53.0 to 5.54.1 ([#113](https://github.com/flex-development/errnode/issues/113)) ([fd2ae8b](https://github.com/flex-development/errnode/commit/fd2ae8b182ec48f46f14214c9a510445e22971d9)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.58.0 to 5.59.0 ([#158](https://github.com/flex-development/errnode/issues/158)) ([e9951e9](https://github.com/flex-development/errnode/commit/e9951e92dff6d077ec4dccc0532de2abe76909c1)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.59.0 to 5.59.1 ([#171](https://github.com/flex-development/errnode/issues/171)) ([db175d5](https://github.com/flex-development/errnode/commit/db175d55ae1356e20f4f61d78564372e3d66478f)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.59.1 to 5.59.2 ([#177](https://github.com/flex-development/errnode/issues/177)) ([e9816f8](https://github.com/flex-development/errnode/commit/e9816f844e3f287fd3ee7dff23ebb0fbb5509bf4)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.59.2 to 5.59.5 ([#195](https://github.com/flex-development/errnode/issues/195)) ([b57a1ce](https://github.com/flex-development/errnode/commit/b57a1ceda077f69fe23e95564d777308ac50a9d5)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.59.5 to 5.59.7 ([#210](https://github.com/flex-development/errnode/issues/210)) ([fbf308d](https://github.com/flex-development/errnode/commit/fbf308df09abeb4367f9f74041dd2e1d49975f4a)) | ||
* **deps-dev:** Bump @typescript-eslint/eslint-plugin from 5.59.7 to 5.59.8 ([#224](https://github.com/flex-development/errnode/issues/224)) ([2d92d54](https://github.com/flex-development/errnode/commit/2d92d54ec337ddf4c094a8bd7905bfd0ea2ecaf4)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.49.0 to 5.50.0 ([#46](https://github.com/flex-development/errnode/issues/46)) ([33d027f](https://github.com/flex-development/errnode/commit/33d027fbab8025ba56ad6b7ecdc68d4074c59370)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.50.0 to 5.51.0 ([#65](https://github.com/flex-development/errnode/issues/65)) ([84299de](https://github.com/flex-development/errnode/commit/84299de65f759ec3a0cc49f61872cba3bac8f518)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.51.0 to 5.54.1 ([#111](https://github.com/flex-development/errnode/issues/111)) ([66921bf](https://github.com/flex-development/errnode/commit/66921bf1330914602022e08b710c0417600bac44)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.58.0 to 5.59.0 ([#161](https://github.com/flex-development/errnode/issues/161)) ([25e3d30](https://github.com/flex-development/errnode/commit/25e3d30810aba053a96fa958e926f386048b3d66)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.59.0 to 5.59.1 ([#172](https://github.com/flex-development/errnode/issues/172)) ([47b359a](https://github.com/flex-development/errnode/commit/47b359a2b0cd4ba97fe04be2b4595b79572371dc)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.59.1 to 5.59.2 ([#178](https://github.com/flex-development/errnode/issues/178)) ([83c176b](https://github.com/flex-development/errnode/commit/83c176b84178a4972e70959f1a841969255137c8)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.59.2 to 5.59.5 ([#190](https://github.com/flex-development/errnode/issues/190)) ([8fbe933](https://github.com/flex-development/errnode/commit/8fbe933e5cebd0bad9d580f5210373d40db136e0)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.59.5 to 5.59.7 ([#211](https://github.com/flex-development/errnode/issues/211)) ([317c42c](https://github.com/flex-development/errnode/commit/317c42cbcf6a5cfcf7f5b9f2e53c495ea741cbad)) | ||
* **deps-dev:** Bump @typescript-eslint/parser from 5.59.7 to 5.59.8 ([#222](https://github.com/flex-development/errnode/issues/222)) ([e28f4fb](https://github.com/flex-development/errnode/commit/e28f4fbb67d42f6b7b3b64ffeac016b244516e91)) | ||
* **deps-dev:** bump @vitest/coverage-c8 from 0.28.3 to 0.28.4 ([560fff2](https://github.com/flex-development/errnode/commit/560fff2a3f13b18752069e414d81f64d79553286)) | ||
* **deps-dev:** Bump @vitest/coverage-c8 from 0.30.0 to 0.30.1 ([#145](https://github.com/flex-development/errnode/issues/145)) ([7ebcdd1](https://github.com/flex-development/errnode/commit/7ebcdd14b919a2e7923c48cdbbc9937f7450b4fb)) | ||
* **deps-dev:** Bump @vitest/coverage-c8 from 0.30.1 to 0.31.0 ([#181](https://github.com/flex-development/errnode/issues/181)) ([954ee70](https://github.com/flex-development/errnode/commit/954ee705d39421c2b74ff88cbce08b75f4949b5d)) | ||
* **deps-dev:** Bump @vitest/coverage-c8 from 0.31.0 to 0.31.1 ([#213](https://github.com/flex-development/errnode/issues/213)) ([369164c](https://github.com/flex-development/errnode/commit/369164c5febf916056012ed5280b8830fd3f5697)) | ||
* **deps-dev:** Bump @vitest/coverage-c8 from 0.31.1 to 0.31.4 ([#226](https://github.com/flex-development/errnode/issues/226)) ([59197f2](https://github.com/flex-development/errnode/commit/59197f26d46b8ac24dc4b3dd96723ea6b0e41674)) | ||
* **deps-dev:** Bump @vitest/ui from 0.28.3 to 0.28.4 ([#60](https://github.com/flex-development/errnode/issues/60)) ([6a9c605](https://github.com/flex-development/errnode/commit/6a9c6054607e4e13e874abe096ae0a82c7defd59)) | ||
* **deps-dev:** Bump @vitest/ui from 0.30.0 to 0.30.1 ([#148](https://github.com/flex-development/errnode/issues/148)) ([612e417](https://github.com/flex-development/errnode/commit/612e41773f43a3d33b6da2a5bf1d8a51e7e320fd)) | ||
* **deps-dev:** Bump @vitest/ui from 0.30.1 to 0.31.0 ([#180](https://github.com/flex-development/errnode/issues/180)) ([0f3c8b6](https://github.com/flex-development/errnode/commit/0f3c8b6ed29170e5255d5709c660faa39b3a1602)) | ||
* **deps-dev:** Bump @vitest/ui from 0.31.0 to 0.31.1 ([#221](https://github.com/flex-development/errnode/issues/221)) ([e9dd138](https://github.com/flex-development/errnode/commit/e9dd138a2296e1314e9eeafa9ead2b065a160fe4)) | ||
* **deps-dev:** Bump cspell from 6.19.2 to 6.23.1 ([#72](https://github.com/flex-development/errnode/issues/72)) ([1daf938](https://github.com/flex-development/errnode/commit/1daf93885528e56c93a7423e23f871c3f6392df2)) | ||
* **deps-dev:** Bump cspell from 6.23.1 to 6.26.3 ([#87](https://github.com/flex-development/errnode/issues/87)) ([5e4d586](https://github.com/flex-development/errnode/commit/5e4d586c9d3cd62323fd591c8567d9ac964c5a8d)) | ||
* **deps-dev:** Bump esbuild from 0.17.16 to 0.17.17 ([#154](https://github.com/flex-development/errnode/issues/154)) ([d0fd67a](https://github.com/flex-development/errnode/commit/d0fd67ac42ebc1b14b8bb0f0a81d02ba1edc1017)) | ||
* **deps-dev:** Bump esbuild from 0.17.17 to 0.17.18 ([#169](https://github.com/flex-development/errnode/issues/169)) ([98f538b](https://github.com/flex-development/errnode/commit/98f538bc00b4792691dbe4e485b7ceb6ece263c3)) | ||
* **deps-dev:** Bump esbuild from 0.17.18 to 0.17.19 ([#203](https://github.com/flex-development/errnode/issues/203)) ([edca467](https://github.com/flex-development/errnode/commit/edca4676a782c2c3432e6d2aed062b2832de4a60)) | ||
* **deps-dev:** Bump esbuild from 0.17.5 to 0.17.6 ([#63](https://github.com/flex-development/errnode/issues/63)) ([8c092ca](https://github.com/flex-development/errnode/commit/8c092ca57c6e78cfc141319f89b31d33f3e04739)) | ||
* **deps-dev:** Bump esbuild from 0.17.6 to 0.17.7 ([#75](https://github.com/flex-development/errnode/issues/75)) ([ea2087f](https://github.com/flex-development/errnode/commit/ea2087f34fbcc68fb4aa0048bc38d42da87f01fd)) | ||
* **deps-dev:** Bump esbuild from 0.17.7 to 0.17.8 ([#79](https://github.com/flex-development/errnode/issues/79)) ([75f6529](https://github.com/flex-development/errnode/commit/75f6529f7d7bd382eec202e38e429575d63244d0)) | ||
* **deps-dev:** Bump eslint and @types/eslint ([#52](https://github.com/flex-development/errnode/issues/52)) ([8ffbdfb](https://github.com/flex-development/errnode/commit/8ffbdfb4ae67800d250b4bf0e5815815ef866a99)) | ||
* **deps-dev:** Bump eslint from 8.33.0 to 8.34.0 ([#74](https://github.com/flex-development/errnode/issues/74)) ([312a05d](https://github.com/flex-development/errnode/commit/312a05dc3a4ab2722e999ee4fa3052d155abeb42)) | ||
* **deps-dev:** Bump eslint from 8.38.0 to 8.39.0 ([#168](https://github.com/flex-development/errnode/issues/168)) ([4418434](https://github.com/flex-development/errnode/commit/4418434088b804d2a400eed59dc55877a3ae1905)) | ||
* **deps-dev:** Bump eslint-plugin-import from 2.27.5 to 2.28.0 ([#254](https://github.com/flex-development/errnode/issues/254)) ([9b06025](https://github.com/flex-development/errnode/commit/9b06025af6c28965dcb72dbf15a914dc42021f43)) | ||
* **deps-dev:** Bump eslint-plugin-jsdoc from 39.7.0 to 39.8.0 ([#53](https://github.com/flex-development/errnode/issues/53)) ([8450fd8](https://github.com/flex-development/errnode/commit/8450fd82b7dc40adf9dec4f34f3eccdb34bcdf71)) | ||
* **deps-dev:** Bump eslint-plugin-jsonc from 2.7.0 to 2.8.0 ([#198](https://github.com/flex-development/errnode/issues/198)) ([0c367ed](https://github.com/flex-development/errnode/commit/0c367ed8a65febcb208b4a9c36eb563deabe13e2)) | ||
* **deps-dev:** Bump eslint-plugin-yml from 1.4.0 to 1.5.0 ([#78](https://github.com/flex-development/errnode/issues/78)) ([ea83f39](https://github.com/flex-development/errnode/commit/ea83f398ad9f6f91fef01350e759a5a04c944114)) | ||
* **deps-dev:** Bump eslint-plugin-yml from 1.5.0 to 1.6.0 ([#188](https://github.com/flex-development/errnode/issues/188)) ([9feca35](https://github.com/flex-development/errnode/commit/9feca350a94da819da99cb3fc6fb46c5b4dfdab8)) | ||
* **deps-dev:** Bump eslint-plugin-yml from 1.6.0 to 1.7.0 ([#199](https://github.com/flex-development/errnode/issues/199)) ([82ddb72](https://github.com/flex-development/errnode/commit/82ddb721a57493bd2b92dcd7705231f6b634b3f5)) | ||
* **deps-dev:** Bump graphql-config from 4.4.0 to 4.4.1 ([#59](https://github.com/flex-development/errnode/issues/59)) ([01106b0](https://github.com/flex-development/errnode/commit/01106b0a6359645706562b4156ce206ce00a562b)) | ||
* **deps-dev:** Bump jsonc-eslint-parser from 2.2.0 to 2.3.0 ([#197](https://github.com/flex-development/errnode/issues/197)) ([4e9edc0](https://github.com/flex-development/errnode/commit/4e9edc002ea38bc26ecc6247c969a5291f129768)) | ||
* **deps-dev:** Bump lint-staged from 13.1.0 to 13.1.1 ([#76](https://github.com/flex-development/errnode/issues/76)) ([2dc642c](https://github.com/flex-development/errnode/commit/2dc642c73dc8a46a5cb935038d24e190c12023fb)) | ||
* **deps-dev:** Bump lint-staged from 13.1.1 to 13.1.2 ([#84](https://github.com/flex-development/errnode/issues/84)) ([24dbe58](https://github.com/flex-development/errnode/commit/24dbe589d9f03dfb7e2f2d6317f68f15e9b30130)) | ||
* **deps-dev:** Bump lint-staged from 13.2.1 to 13.2.2 ([#175](https://github.com/flex-development/errnode/issues/175)) ([d302c3d](https://github.com/flex-development/errnode/commit/d302c3dbcf92b8e650960199b1aa1a32ec83b72e)) | ||
* **deps-dev:** Bump prettier from 2.8.3 to 2.8.4 ([#66](https://github.com/flex-development/errnode/issues/66)) ([ae9b7b8](https://github.com/flex-development/errnode/commit/ae9b7b80caf5defab5c15f7b7bd4ea732880fdc0)) | ||
* **deps-dev:** Bump prettier from 2.8.7 to 2.8.8 ([#167](https://github.com/flex-development/errnode/issues/167)) ([c6165e7](https://github.com/flex-development/errnode/commit/c6165e769f8f59fbc7f990ccd3d3e2b00e7eb3d7)) | ||
* **deps-dev:** Bump pretty-format from 29.4.1 to 29.4.2 ([#73](https://github.com/flex-development/errnode/issues/73)) ([90a2850](https://github.com/flex-development/errnode/commit/90a2850bffcb38ed555b96c62c8b255fc28197d4)) | ||
* **deps-dev:** Bump pretty-format from 29.4.2 to 29.4.3 ([#92](https://github.com/flex-development/errnode/issues/92)) ([8ae6d8c](https://github.com/flex-development/errnode/commit/8ae6d8c6d3858df8136417c65710df408a412d94)) | ||
* **deps-dev:** Bump semver from 7.4.0 to 7.5.0 ([#159](https://github.com/flex-development/errnode/issues/159)) ([635d730](https://github.com/flex-development/errnode/commit/635d730e47e8776465923cf7452ee3a9df190b3b)) | ||
* **deps-dev:** Bump semver from 7.5.0 to 7.5.1 ([#202](https://github.com/flex-development/errnode/issues/202)) ([a17ad86](https://github.com/flex-development/errnode/commit/a17ad86e5c8a28cf036f68c2f20bb5475627e718)) | ||
* **deps-dev:** Bump semver from 7.5.1 to 7.5.2 ([#237](https://github.com/flex-development/errnode/issues/237)) ([756a057](https://github.com/flex-development/errnode/commit/756a057c3e0235b9f5a7f32d90196bb09f459a12)) | ||
* **deps-dev:** Bump the conventional-changelog group with 5 updates ([#251](https://github.com/flex-development/errnode/issues/251)) ([4988e9f](https://github.com/flex-development/errnode/commit/4988e9ff8890acef45ab1366a65fa0a70fbbf2cb)) | ||
* **deps-dev:** bump typescript from 5.0.0-dev.20230128 to 5.0.0-dev.20230212 ([224fd24](https://github.com/flex-development/errnode/commit/224fd244ddf260fae7db1dbc9998ed82601541cb)) | ||
* **deps-dev:** bump typescript from 5.0.0-dev.20230212 to 5.0.0-dev.20230219 ([cf18790](https://github.com/flex-development/errnode/commit/cf187905d51996ffb90a9325c7f5a605a038f4eb)) | ||
* **deps-dev:** Bump vite from 4.0.4 to 4.1.1 ([#57](https://github.com/flex-development/errnode/issues/57)) ([17983ee](https://github.com/flex-development/errnode/commit/17983eea8618df1f86377baba3efc364d46eb435)) | ||
* **deps-dev:** Bump vite from 4.1.2 to 4.1.3 ([#95](https://github.com/flex-development/errnode/issues/95)) ([4aa8460](https://github.com/flex-development/errnode/commit/4aa8460f194178254f481996f97a508f64903465)) | ||
* **deps-dev:** Bump vite from 4.1.3 to 4.1.4 ([#99](https://github.com/flex-development/errnode/issues/99)) ([75acfe2](https://github.com/flex-development/errnode/commit/75acfe2bde7d501fe313763799f569a7b18e160a)) | ||
* **deps-dev:** Bump vite from 4.2.1 to 4.2.2 ([#162](https://github.com/flex-development/errnode/issues/162)) ([b464168](https://github.com/flex-development/errnode/commit/b464168e1e462090beea536f9b6f0101d9bd678b)) | ||
* **deps-dev:** Bump vite from 4.2.2 to 4.3.1 ([#165](https://github.com/flex-development/errnode/issues/165)) ([c629ae3](https://github.com/flex-development/errnode/commit/c629ae3621e31f4c1ac3fdcd50b7241a3d303b35)) | ||
* **deps-dev:** Bump vite from 4.3.1 to 4.3.2 ([#173](https://github.com/flex-development/errnode/issues/173)) ([07888b8](https://github.com/flex-development/errnode/commit/07888b899e4307791bea3e64e043ba1ff8998556)) | ||
* **deps-dev:** Bump vite from 4.3.2 to 4.3.3 ([#174](https://github.com/flex-development/errnode/issues/174)) ([bcc44db](https://github.com/flex-development/errnode/commit/bcc44db34aca97267b96ae2b8cc0315b204cd275)) | ||
* **deps-dev:** Bump vite from 4.3.3 to 4.3.4 ([#179](https://github.com/flex-development/errnode/issues/179)) ([8f50928](https://github.com/flex-development/errnode/commit/8f509286fc5696e11d0f000a65b8e9cb89b68ff5)) | ||
* **deps-dev:** Bump vite from 4.3.4 to 4.3.5 ([#187](https://github.com/flex-development/errnode/issues/187)) ([90f8739](https://github.com/flex-development/errnode/commit/90f8739edd3efc7356b19708888b37705ab2c0ba)) | ||
* **deps-dev:** Bump vite from 4.3.5 to 4.3.8 ([#217](https://github.com/flex-development/errnode/issues/217)) ([631702f](https://github.com/flex-development/errnode/commit/631702f0914466de5b69f12cf2efc28f843333c6)) | ||
* **deps-dev:** Bump vite from 4.3.8 to 4.3.9 ([#231](https://github.com/flex-development/errnode/issues/231)) ([e7eb642](https://github.com/flex-development/errnode/commit/e7eb642ce3e2276afebe84b590874b51453d0506)) | ||
* **deps-dev:** Bump vite-tsconfig-paths from 4.1.0 to 4.2.0 ([#151](https://github.com/flex-development/errnode/issues/151)) ([a1dd94c](https://github.com/flex-development/errnode/commit/a1dd94c86d7d870808be468e52badd901a908791)) | ||
* **deps-dev:** bump vitest from 0.28.3 to 0.28.4 ([a1c76da](https://github.com/flex-development/errnode/commit/a1c76dafec78d9f918e55d49093fa662da3d3d9a)) | ||
* **deps-dev:** Bump vitest from 0.30.0 to 0.30.1 ([#149](https://github.com/flex-development/errnode/issues/149)) ([a3374a3](https://github.com/flex-development/errnode/commit/a3374a39b73c36f0f518cd60556dd391d0f4751e)) | ||
* **deps-dev:** Bump vitest from 0.30.1 to 0.31.0 ([#182](https://github.com/flex-development/errnode/issues/182)) ([611d87d](https://github.com/flex-development/errnode/commit/611d87d2c7dc44aa57dc5499cf2ffd85c4165bbf)) | ||
* **deps-dev:** Bump vitest from 0.31.0 to 0.31.1 ([#219](https://github.com/flex-development/errnode/issues/219)) ([cb8c463](https://github.com/flex-development/errnode/commit/cb8c46326e3fd349be573a8ce5ca3832c0322140)) | ||
* **deps-dev:** Bump yaml-eslint-parser from 1.2.0 to 1.2.2 ([#193](https://github.com/flex-development/errnode/issues/193)) ([badf933](https://github.com/flex-development/errnode/commit/badf933c1db8fbc0f903a8c80dc42de17da102dc)) | ||
* **deps:** bump @flex-development/tutils from 6.0.0-alpha.10 to 6.0.0-alpha.12 ([bb8d48a](https://github.com/flex-development/errnode/commit/bb8d48a2cef4d5e76c30a29361417f00d803a415)) | ||
* **nvm:** require `>=16.20.0` ([0475cd4](https://github.com/flex-development/errnode/commit/0475cd4f04ecfc5fe8d913f6b8a8b81c8d35cb40)) | ||
* **yarn:** bump yarn from 4.0.0-rc.34 to 4.0.0-rc.39 ([238ba75](https://github.com/flex-development/errnode/commit/238ba75fcddf561a257416ae175e471336155891)) | ||
### :robot: Continuous Integration | ||
* [[@dependabot](https://github.com/dependabot)] configure grouped version updates ([4fd9226](https://github.com/flex-development/errnode/commit/4fd92268d9de15475c60e4d88a4978b40361938d)) | ||
* [[@dependabot](https://github.com/dependabot)] remove `@types/node` from ignore list ([9b48fd1](https://github.com/flex-development/errnode/commit/9b48fd103436881a859c238801a7545da41bc8bc)) | ||
* fix [@dependabot](https://github.com/dependabot) npm package-ecosystem x yarn integration ([131b4d4](https://github.com/flex-development/errnode/commit/131b4d40ac4eee048c6bfe05fc71b7df8bbc02da)) | ||
* **deps:** Bump actions/add-to-project from 0.4.0 to 0.4.1 ([#105](https://github.com/flex-development/errnode/issues/105)) ([4bde1d3](https://github.com/flex-development/errnode/commit/4bde1d3648b15911b436f770132873e974da0e01)) | ||
* **deps:** Bump actions/add-to-project from 0.4.1 to 0.5.0 ([#133](https://github.com/flex-development/errnode/issues/133)) ([3e55089](https://github.com/flex-development/errnode/commit/3e55089193cd885faddbc44e4e4c4dd307477928)) | ||
* **deps:** Bump actions/cache from 3.2.3 to 3.2.4 ([#44](https://github.com/flex-development/errnode/issues/44)) ([fe053ce](https://github.com/flex-development/errnode/commit/fe053ceb0010363497796dc1884ce4ea2c4a7767)) | ||
* **deps:** Bump actions/cache from 3.2.4 to 3.2.5 ([#70](https://github.com/flex-development/errnode/issues/70)) ([3f10d76](https://github.com/flex-development/errnode/commit/3f10d76bf39e42f4a9ead322c8738003ecbe7252)) | ||
* **deps:** Bump actions/cache from 3.2.5 to 3.2.6 ([#97](https://github.com/flex-development/errnode/issues/97)) ([cadf670](https://github.com/flex-development/errnode/commit/cadf670526e5efe4dff201d7e68815fb0cd8b8bb)) | ||
* **deps:** Bump actions/cache from 3.2.6 to 3.3.0 ([#115](https://github.com/flex-development/errnode/issues/115)) ([c46fcbb](https://github.com/flex-development/errnode/commit/c46fcbbd7c3dc80da3db3e5e87f0ed294fa15526)) | ||
* **deps:** Bump actions/cache from 3.3.0 to 3.3.1 ([#117](https://github.com/flex-development/errnode/issues/117)) ([0345849](https://github.com/flex-development/errnode/commit/034584979bce97c9a0963759ba03bd93b1f220fd)) | ||
* **deps:** Bump actions/checkout from 3.2.0 to 3.3.0 ([#102](https://github.com/flex-development/errnode/issues/102)) ([aabf757](https://github.com/flex-development/errnode/commit/aabf757ff2b745bdd76396d5322aa3c53933bec6)) | ||
* **deps:** Bump actions/checkout from 3.3.0 to 3.4.0 ([#122](https://github.com/flex-development/errnode/issues/122)) ([4d75129](https://github.com/flex-development/errnode/commit/4d7512952fab90b864505b3aa1ffe37a683a73cd)) | ||
* **deps:** Bump actions/checkout from 3.4.0 to 3.5.0 ([#127](https://github.com/flex-development/errnode/issues/127)) ([9bec5b0](https://github.com/flex-development/errnode/commit/9bec5b0624afa136b682dc1228a90503c0a552da)) | ||
* **deps:** Bump actions/checkout from 3.5.0 to 3.5.2 ([#152](https://github.com/flex-development/errnode/issues/152)) ([ddee320](https://github.com/flex-development/errnode/commit/ddee32044f80aa934d3d2e43aa1a7b6d97dabac9)) | ||
* **deps:** Bump actions/checkout from 3.5.2 to 3.5.3 ([#234](https://github.com/flex-development/errnode/issues/234)) ([c0c4db6](https://github.com/flex-development/errnode/commit/c0c4db61a4d4ace831627f0ba2fa34f24da7f954)) | ||
* **deps:** Bump actions/github-script from 6.4.0 to 6.4.1 ([#134](https://github.com/flex-development/errnode/issues/134)) ([922885f](https://github.com/flex-development/errnode/commit/922885f9996ef627abb97fd2e6b390d005f5b1bb)) | ||
* **deps:** Bump actions/setup-node from 3.6.0 to 3.7.0 ([#246](https://github.com/flex-development/errnode/issues/246)) ([50404e9](https://github.com/flex-development/errnode/commit/50404e9b223927f4fcb5269ef52f9b911d52c082)) | ||
* **deps:** Bump codecov/codecov-action from 3.1.1 to 3.1.2 ([#146](https://github.com/flex-development/errnode/issues/146)) ([3f49e6c](https://github.com/flex-development/errnode/commit/3f49e6ca4f44b54404d5a98301b22032ed0b593e)) | ||
* **deps:** Bump codecov/codecov-action from 3.1.2 to 3.1.3 ([#164](https://github.com/flex-development/errnode/issues/164)) ([92f025b](https://github.com/flex-development/errnode/commit/92f025b3a0278d92cbc5033f6ecf0be124486444)) | ||
* **deps:** Bump codecov/codecov-action from 3.1.3 to 3.1.4 ([#204](https://github.com/flex-development/errnode/issues/204)) ([8f3fc2f](https://github.com/flex-development/errnode/commit/8f3fc2fcd3e1f41ae5d46fdbb0505200c24b1aaf)) | ||
* **deps:** Bump crazy-max/ghaction-import-gpg from 5.2.0 to 5.3.0 ([#184](https://github.com/flex-development/errnode/issues/184)) ([b23c985](https://github.com/flex-development/errnode/commit/b23c985c76064e14c282a5f387fdb2bd30af4e4a)) | ||
* **deps:** Bump dependabot/fetch-metadata from 1.3.6 to 1.4.0 ([#157](https://github.com/flex-development/errnode/issues/157)) ([2a3e45b](https://github.com/flex-development/errnode/commit/2a3e45b40c7e36740d5d43b029f9774d5d822bbf)) | ||
* **deps:** Bump dependabot/fetch-metadata from 1.4.0 to 1.5.1 ([#212](https://github.com/flex-development/errnode/issues/212)) ([951282e](https://github.com/flex-development/errnode/commit/951282e23531fa5485827ecc1c92e5cc051b946c)) | ||
* **deps:** Bump dependabot/fetch-metadata from 1.5.1 to 1.6.0 ([#239](https://github.com/flex-development/errnode/issues/239)) ([32cc794](https://github.com/flex-development/errnode/commit/32cc7944aa411751a5530064c842f05b566c5fbd)) | ||
* **deps:** Bump dessant/lock-threads from 4.0.0 to 4.0.1 ([#235](https://github.com/flex-development/errnode/issues/235)) ([6bbc311](https://github.com/flex-development/errnode/commit/6bbc311ee73fa8563a2e293b405bdfc40702fb81)) | ||
* **deps:** Bump octokit/graphql-action from 2.2.23 to 2.2.24 ([#135](https://github.com/flex-development/errnode/issues/135)) ([de554e0](https://github.com/flex-development/errnode/commit/de554e077064ea69d8d0d167975190d2944a009f)) | ||
* **deps:** Bump octokit/graphql-action from 2.2.23 to 2.2.24 ([#139](https://github.com/flex-development/errnode/issues/139)) ([edf46ee](https://github.com/flex-development/errnode/commit/edf46ee8a489c282c8923b46a063e14a20ef1fc5)) | ||
* **deps:** Bump octokit/graphql-action from 2.2.24 to 2.2.25 ([#249](https://github.com/flex-development/errnode/issues/249)) ([1273c3c](https://github.com/flex-development/errnode/commit/1273c3c7fb76ff5a07d34522c8bdbed24e02e3f1)) | ||
* **workflows:** [`approve-pr`] remove `dependabot-metadata` condition ([d9a2b84](https://github.com/flex-development/errnode/commit/d9a2b84a56eabe7e624e060851d155c10e0a6204)) | ||
* **workflows:** [`ci`] add `gitguardian` job ([adb9b48](https://github.com/flex-development/errnode/commit/adb9b487c7ecb3eba4d56116788fb86c41860504)) | ||
* **workflows:** [`ci`] use `github.event.pull_request.head.sha` for codecov ([8136c09](https://github.com/flex-development/errnode/commit/8136c09a88de4bdf5f15bba15604c6989adfa22a)) | ||
* **workflows:** [`dependabot-auto`] remove `enable-auto-merge` job conditional ([4d04cd3](https://github.com/flex-development/errnode/commit/4d04cd30171e3be61e37c37110d70c15a5bed7db)) | ||
* **workflows:** add `auto-merge` ([ae98a73](https://github.com/flex-development/errnode/commit/ae98a73215f22d78d76acfe389c0c095bd6f2543)) | ||
* **workflows:** add `cache-cleanup` ([d4aadb9](https://github.com/flex-development/errnode/commit/d4aadb9750c7aeb51776de9d90946586db3abaf2)) | ||
* **workflows:** add `infrastructure` ([d27cd80](https://github.com/flex-development/errnode/commit/d27cd80a4b4e0118e5b58bd2f3bee78934354a38)) | ||
### :sparkles: Features | ||
* support node@20.5.0 ([3a3b18d](https://github.com/flex-development/errnode/commit/3a3b18d6cf4df0f829f032cc6bc9a841251fed2f)) | ||
### :house_with_garden: Housekeeping | ||
* analyze types distribution ([f0fbcb9](https://github.com/flex-development/errnode/commit/f0fbcb9b8100d956f854370cbed03853eb631162)) | ||
* sync config files ([05b5ddb](https://github.com/flex-development/errnode/commit/05b5ddbaa0298c6774ee784d3df2958f77faa9f6)) | ||
* update config files ([572df84](https://github.com/flex-development/errnode/commit/572df8444561893736091e45a4b307c76282f278)) | ||
* update dev and test environments ([19fcb86](https://github.com/flex-development/errnode/commit/19fcb8634712af9d9a8e15dc9ac68574342e74bd)) | ||
* **github:** add commit scope `build` ([afe314b](https://github.com/flex-development/errnode/commit/afe314b9adba3e21a88e3734ef6225b8fdcd4c98)) | ||
* **github:** add commit scope `loader` ([7ba7083](https://github.com/flex-development/errnode/commit/7ba708338d00a7da732fcc95a471e0aa342e3a20)) | ||
* **loader:** use `@flex-development/tsconfig-utils` ([0f6924e](https://github.com/flex-development/errnode/commit/0f6924e0b0c0a9ba3d5f9f054a3f352a8c68e5f5)) | ||
### :mechanical_arm: Refactors | ||
* **utils:** [`createNodeError`] use class expression pattern ([83ff48d](https://github.com/flex-development/errnode/commit/83ff48ddcedfab1ae48b1ffe3f09bea118aff2a1)) | ||
## [1.5.0](https://github.com/flex-development/errnode/compare/1.4.0...1.5.0) (2023-02-03) | ||
@@ -2,0 +171,0 @@ |
138
package.json
{ | ||
"name": "@flex-development/errnode", | ||
"description": "Universal API for creating Node.js errors", | ||
"version": "1.5.0", | ||
"version": "2.0.0", | ||
"keywords": [ | ||
"errno", | ||
"error", | ||
@@ -25,2 +26,3 @@ "node", | ||
"files": [ | ||
"CHANGELOG.md", | ||
"dist", | ||
@@ -37,9 +39,10 @@ "src" | ||
"build": "mkbuild", | ||
"changelog": "node --loader=./loader.mjs ./changelog.config.ts", | ||
"check:ci": "yarn dedupe --check && yarn check:format && yarn check:lint && yarn check:spelling && yarn typecheck && yarn test:cov && NODE_ENV=production yarn pack -o %s-%v.tgz && yarn clean:pack && yarn check:types:build", | ||
"changelog": "node --loader=./loader.mjs ./config/changelog.config", | ||
"check:ci": "yarn dedupe --check && yarn check:format && yarn check:lint && yarn check:spelling && yarn typecheck && yarn test:cov && yarn pack && yarn check:types:build && attw package.tgz && yarn clean:pack && yarn pkg-size", | ||
"check:format": "prettier --check .", | ||
"check:lint": "eslint --exit-on-fatal-error --ext cjs,gql,json,jsonc,md,mjs,ts,yml --max-warnings 0 .", | ||
"check:lint": "eslint --exit-on-fatal-error --max-warnings 0 .", | ||
"check:spelling": "cspell lint --color --no-progress --relative $@ \"**\"", | ||
"check:types": "tsc -p tsconfig.typecheck.json", | ||
"check:types:build": "tsc -p tsconfig.build.json", | ||
"check:types:attw": "yarn pack && attw package.tgz && yarn clean:pack", | ||
"check:types:build": "bash ./scripts/typecheck-build.sh", | ||
"check:upgrades": "yarn upgrade-interactive", | ||
@@ -53,2 +56,3 @@ "clean:build": "trash ./{dist,*.tgz}", | ||
"codecov:validate": "cat .codecov.yml | curl --data-binary @- https://codecov.io/validate", | ||
"commitlint": "commitlint -V", | ||
"fix:cg": "yarn fix:format && yarn fix:lint", | ||
@@ -58,2 +62,3 @@ "fix:dedupe": "yarn dedupe --strategy=highest", | ||
"fix:lint": "yarn check:lint --cache --fix", | ||
"pkg-size": "pkg-size --sizes size --sort-by name", | ||
"_postinstall": "[ -f ./node_modules/.bin/husky ] && chmod +x .husky/* && husky install || exit 0", | ||
@@ -68,3 +73,3 @@ "postpack": "toggle-scripts +postinstall", | ||
"test:cov": "yarn clean:coverage; yarn test --coverage", | ||
"test:cov:serve": "serve -l 5432 ./coverage/lcov-report", | ||
"test:cov:serve": "vite preview --outDir ./coverage", | ||
"test:cov:upload": "./codecov -t $CODECOV_TOKEN -f ./coverage/lcov.info", | ||
@@ -76,14 +81,19 @@ "test:watch": "vitest", | ||
"dependencies": { | ||
"@flex-development/tutils": "6.0.0-alpha.10", | ||
"node-inspect-extracted": "2.0.0" | ||
"@flex-development/tutils": "6.0.0-alpha.12", | ||
"node-inspect-extracted": "2.0.2" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "17.4.2", | ||
"@commitlint/config-conventional": "17.4.2", | ||
"@faker-js/faker": "8.0.0-alpha.0", | ||
"@flex-development/mkbuild": "1.0.0-alpha.9", | ||
"@flex-development/mlly": "1.0.0-alpha.9", | ||
"@flex-development/pkg-types": "2.0.0", | ||
"@graphql-eslint/eslint-plugin": "3.15.0", | ||
"@types/chai": "4.3.4", | ||
"@arethetypeswrong/cli": "0.7.0", | ||
"@commitlint/cli": "17.6.7", | ||
"@faker-js/faker": "8.0.2", | ||
"@flex-development/commitlint-config": "1.0.1", | ||
"@flex-development/decorator-regex": "1.0.0", | ||
"@flex-development/esm-types": "2.0.0", | ||
"@flex-development/mkbuild": "1.0.0-alpha.20", | ||
"@flex-development/mlly": "1.0.0-alpha.15", | ||
"@flex-development/pathe": "1.0.3", | ||
"@flex-development/pkg-types": "3.0.0", | ||
"@flex-development/tsconfig-utils": "1.1.2", | ||
"@graphql-eslint/eslint-plugin": "3.20.1", | ||
"@types/chai": "4.3.5", | ||
"@types/chai-string": "1.4.2", | ||
@@ -93,73 +103,69 @@ "@types/conventional-changelog": "3.1.1", | ||
"@types/conventional-changelog-writer": "4.0.2", | ||
"@types/conventional-commits-parser": "3.0.3", | ||
"@types/conventional-recommended-bump": "6.1.0", | ||
"@types/dateformat": "5.0.0", | ||
"@types/eslint": "8.4.10", | ||
"@types/fs-extra": "11.0.1", | ||
"@types/eslint": "8.44.1", | ||
"@types/git-raw-commits": "2.0.1", | ||
"@types/is-ci": "3.0.0", | ||
"@types/node": "16.18.11", | ||
"@types/node": "20.4.5", | ||
"@types/node-notifier": "8.0.2", | ||
"@types/prettier": "2.7.2", | ||
"@typescript-eslint/eslint-plugin": "5.49.0", | ||
"@typescript-eslint/parser": "5.49.0", | ||
"@types/prettier": "2.7.3", | ||
"@types/semver": "7.5.0", | ||
"@typescript-eslint/eslint-plugin": "6.2.0", | ||
"@typescript-eslint/parser": "6.2.0", | ||
"@vates/toggle-scripts": "1.0.0", | ||
"@vitest/coverage-c8": "0.28.3", | ||
"@vitest/ui": "0.28.3", | ||
"@vitest/coverage-v8": "0.33.0", | ||
"add-stream": "1.0.0", | ||
"chai": "4.3.7", | ||
"chai": "5.0.0-alpha.1", | ||
"chai-string": "1.5.0", | ||
"conventional-changelog": "3.1.25", | ||
"conventional-changelog-conventionalcommits": "5.0.0", | ||
"conventional-changelog-core": "4.2.4", | ||
"conventional-changelog-writer": "5.0.1", | ||
"conventional-commits-parser": "3.2.4", | ||
"conventional-recommended-bump": "6.1.0", | ||
"conventional-changelog": "4.0.0", | ||
"conventional-changelog-conventionalcommits": "6.1.0", | ||
"conventional-changelog-core": "5.0.2", | ||
"conventional-changelog-writer": "6.0.1", | ||
"conventional-recommended-bump": "7.0.1", | ||
"cross-env": "7.0.3", | ||
"cspell": "6.19.2", | ||
"esbuild": "0.17.5", | ||
"eslint": "8.32.0", | ||
"eslint-config-prettier": "8.6.0", | ||
"cspell": "6.31.2", | ||
"dateformat": "5.0.3", | ||
"esbuild": "0.18.17", | ||
"eslint": "8.45.0", | ||
"eslint-config-prettier": "8.9.0", | ||
"eslint-import-resolver-typescript": "3.5.5", | ||
"eslint-plugin-chai-expect": "3.0.0", | ||
"eslint-plugin-import": "2.28.0", | ||
"eslint-plugin-jest-formatting": "3.1.0", | ||
"eslint-plugin-jsdoc": "39.7.0", | ||
"eslint-plugin-jsonc": "2.6.0", | ||
"eslint-plugin-jsdoc": "44.1.0", | ||
"eslint-plugin-jsonc": "2.9.0", | ||
"eslint-plugin-markdown": "3.0.0", | ||
"eslint-plugin-markdownlint": "0.4.0", | ||
"eslint-plugin-markdownlint": "0.4.1", | ||
"eslint-plugin-node": "11.1.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"eslint-plugin-prettier": "5.0.0", | ||
"eslint-plugin-promise": "6.1.1", | ||
"eslint-plugin-unicorn": "45.0.2", | ||
"eslint-plugin-yml": "1.4.0", | ||
"graphql": "16.6.0", | ||
"graphql-config": "4.4.0", | ||
"eslint-plugin-unicorn": "48.0.1", | ||
"eslint-plugin-yml": "1.8.0", | ||
"graphql": "16.7.1", | ||
"graphql-config": "5.0.2", | ||
"growl": "1.10.5", | ||
"husky": "8.0.3", | ||
"is-ci": "3.0.1", | ||
"jsonc-eslint-parser": "2.1.0", | ||
"lint-staged": "13.1.0", | ||
"jsonc-eslint-parser": "2.3.0", | ||
"lint-staged": "13.2.3", | ||
"mri": "1.2.0", | ||
"node-notifier": "10.0.1", | ||
"prettier": "2.8.3", | ||
"prettier-plugin-sh": "0.12.8", | ||
"pretty-format": "29.4.1", | ||
"pkg-size": "2.4.0", | ||
"prettier": "3.0.0", | ||
"prettier-plugin-sh": "0.13.1", | ||
"sade": "1.8.1", | ||
"semver": "7.3.8", | ||
"serve": "14.2.0", | ||
"tempfile": "4.0.0", | ||
"semver": "7.5.4", | ||
"tempfile": "5.0.0", | ||
"trash-cli": "5.0.0", | ||
"ts-dedent": "2.2.0", | ||
"typescript": "5.0.0-dev.20230128", | ||
"typescript": "5.1.6", | ||
"version-bump-prompt": "6.1.0", | ||
"vite": "4.0.4", | ||
"vite-tsconfig-paths": "4.0.5", | ||
"vitest": "0.28.3", | ||
"vitest-github-actions-reporter": "0.9.0", | ||
"yaml-eslint-parser": "1.1.0" | ||
"vite": "4.4.7", | ||
"vite-tsconfig-paths": "4.2.0", | ||
"vitest": "0.33.0", | ||
"vitest-github-actions-reporter": "0.10.0", | ||
"yaml-eslint-parser": "1.2.2" | ||
}, | ||
"bundleDependencies": [ | ||
"node-inspect-extracted" | ||
], | ||
"peerDependencies": { | ||
"@types/node": ">=14" | ||
"@types/node": ">=16.18.23" | ||
}, | ||
@@ -173,9 +179,9 @@ "peerDependenciesMeta": { | ||
"@ardatan/sync-fetch": "larsgw/sync-fetch#head=worker_threads", | ||
"@flex-development/tutils": "6.0.0-alpha.10" | ||
"@flex-development/tutils": "6.0.0-alpha.12" | ||
}, | ||
"engines": { | ||
"node": ">=14.16", | ||
"yarn": "4.0.0-rc.34" | ||
"node": ">=16.20.0", | ||
"yarn": "4.0.0-rc.39" | ||
}, | ||
"packageManager": "yarn@4.0.0-rc.34", | ||
"packageManager": "yarn@4.0.0-rc.39", | ||
"readme": "README.md", | ||
@@ -182,0 +188,0 @@ "sideEffects": false, |
# errnode | ||
[![github release](https://img.shields.io/github/v/release/flex-development/errnode.svg?include_prereleases&sort=semver)](https://github.com/flex-development/errnode/releases/latest) | ||
[![npm](https://img.shields.io/npm/v/@flex-development/errnode.svg)](https://npmjs.com/package/@flex-development/errnode) | ||
@@ -143,8 +144,7 @@ [![codecov](https://codecov.io/gh/flex-development/errnode/branch/main/graph/badge.svg?token=e2gnycTeI9)](https://codecov.io/gh/flex-development/errnode) | ||
* @param {string} input - URL that failed to parse | ||
* @return {ErrInvalidUrl} `TypeError` instance | ||
* @return {ErrInvalidUrl} New `TypeError` instance | ||
*/ | ||
const ERR_INVALID_URL: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
MessageFn<[string]>, | ||
ErrInvalidUrl | ||
ErrInvalidUrl, | ||
MessageFn<[string]> | ||
> = createNodeError( | ||
@@ -247,3 +247,3 @@ ErrorCode.ERR_INVALID_URL, | ||
Constructor functions representing [Node.js error codes][7], callable with and without the `new` keyword. Constructor | ||
Constructor functions representing [Node.js error codes][7], callable **only** with the `new` keyword. Constructor | ||
arguments are used to generate error messages. | ||
@@ -582,11 +582,11 @@ | ||
If the given error `message` is a function, constructor arguments are passed to `message`. If the `message` is a string, | ||
constructor arguments are passed to [`util.format`][15] instead. | ||
Constructor arguments are passed to [`util.format`][15] if the error `message` is a string, or `message` itself if it is | ||
a function. Message functions will also be called with the new Node.js error instance as `this`. | ||
- `{ErrorCode}` **`code`** — Node.js error code | ||
- `{B extends ErrorConstructor}` **`Base`** — Error base class | ||
- `{M extends any[] | MessageFn | string}` **`message`** — Error message or message function | ||
- **Returns**: `{NodeErrorConstructor<B, M>}` `NodeError` constructor | ||
- `{ErrnodeConstructor}` **`Base`** — Error base class | ||
- `{Message}` **`message`** — Error message string or function | ||
- **Returns**: `{NodeErrorConstructor` `NodeError` constructor | ||
> **Source**: [`src/create-node-error.ts`](src/create-node-error.ts) | ||
> **Source**: [`src/utils/create-node-error.ts`](src/utils/create-node-error.ts) | ||
@@ -600,3 +600,3 @@ #### `determineSpecificType(value)` | ||
> **Source**: [`src/determine-specific-type.ts`](src/determine-specific-type.ts) | ||
> **Source**: [`src/utils/determine-specific-type.ts`](src/utils/determine-specific-type.ts) | ||
@@ -614,10 +614,13 @@ ## Types | ||
- [`CallSite`](src/interfaces/call-site.ts) | ||
- [`ErrInvalidUrl`](src/interfaces/err-invalid-url.ts) | ||
- [`ErrnoException`](src/interfaces/errno-exception.ts) | ||
- [`NodeErrorConstructor`](src/interfaces/node-error-constructor.ts) | ||
### Type Definitions | ||
- [`ErrnodeConstructor`](src/types/errnode-constructor.ts) | ||
- [`MessageFn`](src/types/fn-message.ts) | ||
- [`Message`](src/types/message.ts) | ||
- [`NodeError`](src/types/node-error.ts) | ||
- [`NodeErrorConstructor`](src/types/node-error-constructor.ts) | ||
- [`MessageFn`](src/types/fn-message.ts) | ||
@@ -624,0 +627,0 @@ ## Contribute |
@@ -113,2 +113,3 @@ /** | ||
ETXTBSY = 'ETXTBSY', | ||
EUNATCH = 'EUNATCH', | ||
EWOULDBLOCK = 'EWOULDBLOCK', | ||
@@ -115,0 +116,0 @@ EXDEV = 'EXDEV', |
@@ -7,2 +7,3 @@ /** | ||
import type { SystemErrorCode } from '#src/enums' | ||
import type { Optional } from '@flex-development/tutils' | ||
@@ -20,5 +21,3 @@ /** | ||
* | ||
* [1]: {@link ../enums/error-code-system.ts} | ||
* | ||
* @see [`SystemErrorCode`][1] | ||
* @see {@linkcode SystemErrorCode} | ||
*/ | ||
@@ -46,3 +45,3 @@ code: SystemErrorCode | ||
*/ | ||
message: NonNullable<Error['message']> | ||
message: Error['message'] | ||
@@ -53,3 +52,3 @@ /** | ||
*/ | ||
path?: string | undefined | ||
path?: Optional<string> | ||
@@ -56,0 +55,0 @@ /** |
@@ -8,1 +8,2 @@ /** | ||
export type { default as ErrnoException } from './errno-exception' | ||
export type { default as NodeErrorConstructor } from './node-error-constructor' |
@@ -7,2 +7,4 @@ /** | ||
import { at, join } from '@flex-development/tutils' | ||
/** | ||
@@ -25,8 +27,8 @@ * Creates a list string in the form `'A and B'` or `'A, B, ..., and Z`. | ||
*/ | ||
function formatList(arr: string[], transition: string = 'and'): string { | ||
const formatList = (arr: string[], transition: string = 'and'): string => { | ||
return arr.length < 3 | ||
? arr.join(` ${transition} `) | ||
: `${arr.slice(0, -1).join(', ')}, ${transition} ${arr[arr.length - 1]}` | ||
? join(arr, ` ${transition} `) | ||
: join([`${join(arr.slice(0, -1), ', ')},`, transition, at(arr, -1)], ' ') | ||
} | ||
export default formatList |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -24,7 +26,7 @@ /** | ||
* @param {string} reason - Reason `name` is ambiguous | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_AMBIGUOUS_ARGUMENT: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
[string, string] | ||
TypeError, | ||
Times<2, string> | ||
> = createNodeError( | ||
@@ -31,0 +33,0 @@ ErrorCode.ERR_AMBIGUOUS_ARGUMENT, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -23,7 +25,7 @@ /** | ||
* @param {string} name - Name of non-iterable argument | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_ARG_NOT_ITERABLE: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
[string] | ||
TypeError, | ||
Times<1, string> | ||
> = createNodeError( | ||
@@ -30,0 +32,0 @@ ErrorCode.ERR_ARG_NOT_ITERABLE, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -23,11 +25,13 @@ /** | ||
* @param {string} name - Name of argument that must be a function | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_ASYNC_CALLBACK: NodeErrorConstructor<TypeErrorConstructor, [string]> = | ||
createNodeError( | ||
ErrorCode.ERR_ASYNC_CALLBACK, | ||
TypeError, | ||
'%s must be a function' | ||
) | ||
const ERR_ASYNC_CALLBACK: NodeErrorConstructor< | ||
TypeError, | ||
Times<1, string> | ||
> = createNodeError( | ||
ErrorCode.ERR_ASYNC_CALLBACK, | ||
TypeError, | ||
'%s must be a function' | ||
) | ||
export default ERR_ASYNC_CALLBACK |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { EmptyArray } from '@flex-development/tutils' | ||
@@ -22,5 +24,5 @@ /** | ||
* | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_ILLEGAL_CONSTRUCTOR: NodeErrorConstructor<TypeErrorConstructor, []> = | ||
const ERR_ILLEGAL_CONSTRUCTOR: NodeErrorConstructor<TypeError, EmptyArray> = | ||
createNodeError( | ||
@@ -27,0 +29,0 @@ ErrorCode.ERR_ILLEGAL_CONSTRUCTOR, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -24,7 +26,7 @@ /** | ||
* @param {string} type - Invalid import assertion type | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_IMPORT_ASSERTION_TYPE_FAILED: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
[string, string] | ||
TypeError, | ||
Times<2, string> | ||
> = createNodeError( | ||
@@ -31,0 +33,0 @@ ErrorCode.ERR_IMPORT_ASSERTION_TYPE_FAILED, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -24,7 +26,7 @@ /** | ||
* @param {string} type - Required import assertion type | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_IMPORT_ASSERTION_TYPE_MISSING: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
[string, string] | ||
TypeError, | ||
Times<2, string> | ||
> = createNodeError( | ||
@@ -31,0 +33,0 @@ ErrorCode.ERR_IMPORT_ASSERTION_TYPE_MISSING, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -22,7 +24,7 @@ /** | ||
* @param {string} type - Unsupported import assertion type | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_IMPORT_ASSERTION_TYPE_UNSUPPORTED: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
[string] | ||
TypeError, | ||
Times<1, string> | ||
> = createNodeError( | ||
@@ -29,0 +31,0 @@ ErrorCode.ERR_IMPORT_ASSERTION_TYPE_UNSUPPORTED, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -24,7 +26,7 @@ /** | ||
* @param {string} option2 - Option that is incompatible with `option1` | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_INCOMPATIBLE_OPTION_PAIR: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
[string, string] | ||
TypeError, | ||
Times<2, string> | ||
> = createNodeError( | ||
@@ -31,0 +33,0 @@ ErrorCode.ERR_INCOMPATIBLE_OPTION_PAIR, |
@@ -8,6 +8,13 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import formatList from '#src/internal/format-list' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError, determineSpecificType } from '#src/utils' | ||
import type { OneOrMany } from '@flex-development/tutils' | ||
import { | ||
DOT, | ||
includes, | ||
isArray, | ||
lowercase, | ||
type OneOrMany | ||
} from '@flex-development/tutils' | ||
@@ -26,6 +33,6 @@ /** | ||
* @param {unknown} actual - Value supplied by user | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_INVALID_ARG_TYPE: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
TypeError, | ||
MessageFn<[string, OneOrMany<string>, unknown]> | ||
@@ -52,3 +59,3 @@ > = createNodeError( | ||
// ensure expected is an array | ||
if (!Array.isArray(expected)) expected = [expected] | ||
if (!isArray(expected)) expected = [expected] | ||
@@ -84,3 +91,3 @@ /** | ||
? name | ||
: `'${name}' ${name.includes('.') ? 'property' : 'argument'}` | ||
: `'${name}' ${includes(name, DOT) ? 'property' : 'argument'}` | ||
@@ -158,3 +165,3 @@ // continue building error message | ||
/* c8 ignore next */ | ||
if (other[0]!.toLowerCase() !== other[0]) msg += 'an ' | ||
if (lowercase(other[0]!) !== other[0]) msg += 'an ' | ||
msg += `${other[0]}` | ||
@@ -161,0 +168,0 @@ } |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import { DOT, includes, truncate } from '@flex-development/tutils' | ||
import { inspect } from 'node-inspect-extracted' | ||
@@ -26,6 +28,6 @@ | ||
* @param {string?} [reason='is invalid'] - Reason `value` is invalid | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_INVALID_ARG_VALUE: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
TypeError, | ||
MessageFn<[string, unknown, string?]> | ||
@@ -63,6 +65,6 @@ > = createNodeError( | ||
// trim inspected value | ||
if (inspected.length > 128) inspected = inspected.slice(0, 128) + '...' | ||
if (inspected.length > 128) inspected = truncate(inspected, 131) | ||
// add stylized invalid argument or property name | ||
ret += ` ${name.includes('.') ? 'property' : 'argument'} '${name}'` | ||
ret += ` ${includes(name, DOT) ? 'property' : 'argument'} '${name}'` | ||
@@ -73,3 +75,3 @@ // add reason for error | ||
// add inspected value | ||
ret += `. Received ${inspected}` | ||
ret += `${DOT} Received ${inspected}` | ||
@@ -76,0 +78,0 @@ return ret |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import { trimEnd } from '@flex-development/tutils' | ||
@@ -25,6 +27,6 @@ /** | ||
* @param {string?} [base=''] - Id of module `request` was imported from | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_INVALID_MODULE_SPECIFIER: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
TypeError, | ||
MessageFn<[string, string?, string?]> | ||
@@ -50,3 +52,3 @@ > = createNodeError( | ||
*/ | ||
let ret: string = `Invalid module '${request}' ${reason}`.trimEnd() | ||
let ret: string = trimEnd(`Invalid module '${request}' ${reason}`) | ||
@@ -53,0 +55,0 @@ // add details regarding where error occurred |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import { DOT } from '@flex-development/tutils' | ||
@@ -27,6 +29,6 @@ /** | ||
* @param {string?} [reason=''] - Reason package config is invalid | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_INVALID_PACKAGE_CONFIG: NodeErrorConstructor< | ||
ErrorConstructor, | ||
Error, | ||
MessageFn<[string, string?, string?]> | ||
@@ -59,3 +61,3 @@ > = createNodeError( | ||
// add reason package config is invalid | ||
if (reason) ret += `. ${reason}` | ||
if (reason) ret += `${DOT} ${reason}` | ||
@@ -62,0 +64,0 @@ return ret |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import { DOT, ifelse } from '@flex-development/tutils' | ||
@@ -30,6 +32,6 @@ /** | ||
* @param {string?} [base=''] - Id of module `package.json` was imported from | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_INVALID_PACKAGE_TARGET: NodeErrorConstructor< | ||
ErrorConstructor, | ||
Error, | ||
MessageFn<[string, string, unknown, boolean?, string?]> | ||
@@ -68,3 +70,3 @@ > = createNodeError( | ||
*/ | ||
const main: boolean = !internal && key === '.' | ||
const main: boolean = !internal && key === DOT | ||
@@ -76,3 +78,3 @@ /** | ||
*/ | ||
let ret: string = `Invalid "${internal ? 'imports' : 'exports'}"` | ||
let ret: string = `Invalid "${ifelse(internal, 'imports', 'exports')}"` | ||
@@ -96,4 +98,4 @@ // include if package target is main entry point | ||
ret += | ||
typeof target === 'string' && !internal && !target.startsWith('./') | ||
? '; targets must start with "./"' | ||
typeof target === 'string' && !internal && !target.startsWith(`${DOT}/`) | ||
? `; targets must start with "${DOT}/"` | ||
: '' | ||
@@ -100,0 +102,0 @@ |
@@ -8,3 +8,4 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError, determineSpecificType } from '#src/utils' | ||
@@ -25,6 +26,6 @@ | ||
* @param {unknown} value - Value supplied by user | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_INVALID_RETURN_VALUE: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
TypeError, | ||
MessageFn<[string, string, unknown]> | ||
@@ -31,0 +32,0 @@ > = createNodeError( |
@@ -8,4 +8,4 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { ErrInvalidUrl } from '#src/interfaces' | ||
import type { MessageFn, NodeErrorConstructor } from '#src/types' | ||
import type { ErrInvalidUrl, NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
@@ -31,5 +31,4 @@ | ||
const ERR_INVALID_URL: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
MessageFn<[string]>, | ||
ErrInvalidUrl | ||
ErrInvalidUrl, | ||
MessageFn<[string]> | ||
> = createNodeError( | ||
@@ -36,0 +35,0 @@ ErrorCode.ERR_INVALID_URL, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -22,7 +24,7 @@ /** | ||
* @param {string} method - Method name | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_METHOD_NOT_IMPLEMENTED: NodeErrorConstructor< | ||
ErrorConstructor, | ||
[string] | ||
Error, | ||
Times<1, string> | ||
> = createNodeError( | ||
@@ -29,0 +31,0 @@ ErrorCode.ERR_METHOD_NOT_IMPLEMENTED, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -23,7 +25,9 @@ /** | ||
* @param {string} option - Option name | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_MISSING_OPTION: NodeErrorConstructor<TypeErrorConstructor, [string]> = | ||
createNodeError(ErrorCode.ERR_MISSING_OPTION, TypeError, '%s is required') | ||
const ERR_MISSING_OPTION: NodeErrorConstructor< | ||
TypeError, | ||
Times<1, string> | ||
> = createNodeError(ErrorCode.ERR_MISSING_OPTION, TypeError, '%s is required') | ||
export default ERR_MISSING_OPTION |
@@ -8,3 +8,4 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
@@ -25,6 +26,6 @@ | ||
* @param {string?} [type='package'] - Module file type | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_MODULE_NOT_FOUND: NodeErrorConstructor< | ||
ErrorConstructor, | ||
Error, | ||
MessageFn<[string, string, string?]> | ||
@@ -31,0 +32,0 @@ > = createNodeError( |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -25,7 +27,7 @@ /** | ||
* @param {string} reason - Reason for error | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_NETWORK_IMPORT_DISALLOWED: NodeErrorConstructor< | ||
ErrorConstructor, | ||
[string, string, string] | ||
Error, | ||
Times<3, string> | ||
> = createNodeError( | ||
@@ -32,0 +34,0 @@ ErrorCode.ERR_NETWORK_IMPORT_DISALLOWED, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -23,7 +25,13 @@ /** | ||
* @param {string} reason - Reason for operation failure | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_OPERATION_FAILED: NodeErrorConstructor<ErrorConstructor, [string]> = | ||
createNodeError(ErrorCode.ERR_OPERATION_FAILED, Error, 'Operation failed: %s') | ||
const ERR_OPERATION_FAILED: NodeErrorConstructor< | ||
Error, | ||
Times<1, string> | ||
> = createNodeError( | ||
ErrorCode.ERR_OPERATION_FAILED, | ||
Error, | ||
'Operation failed: %s' | ||
) | ||
export default ERR_OPERATION_FAILED |
@@ -8,3 +8,4 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
@@ -27,6 +28,6 @@ | ||
* @param {string?} [dir=''] - Id of directory containing `package.json` | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_PACKAGE_IMPORT_NOT_DEFINED: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
TypeError, | ||
MessageFn<[string, string, string?]> | ||
@@ -33,0 +34,0 @@ > = createNodeError( |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import { DOT } from '@flex-development/tutils' | ||
@@ -27,7 +29,7 @@ /** | ||
* @param {string?} [base=''] - Id of module `subpath` was imported from | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_PACKAGE_PATH_NOT_EXPORTED: NodeErrorConstructor< | ||
ErrorConstructor, | ||
[string, string, string?] | ||
Error, | ||
MessageFn<[string, string, string?]> | ||
> = createNodeError( | ||
@@ -53,3 +55,3 @@ ErrorCode.ERR_PACKAGE_PATH_NOT_EXPORTED, | ||
let message: string = | ||
subpath === '.' | ||
subpath === DOT | ||
? "No 'exports' main defined in" | ||
@@ -56,0 +58,0 @@ : `Package subpath '${subpath}' is not defined by 'exports' in` |
@@ -8,3 +8,4 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
@@ -22,28 +23,30 @@ | ||
* @param {string?} [err=''] - Stringified error | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_UNHANDLED_ERROR: NodeErrorConstructor<ErrorConstructor, [string?]> = | ||
createNodeError( | ||
ErrorCode.ERR_UNHANDLED_ERROR, | ||
Error, | ||
const ERR_UNHANDLED_ERROR: NodeErrorConstructor< | ||
Error, | ||
MessageFn<[string?]> | ||
> = createNodeError( | ||
ErrorCode.ERR_UNHANDLED_ERROR, | ||
Error, | ||
/** | ||
* Creates an [`ERR_UNHANDLED_ERROR`][1] message. | ||
* | ||
* [1]: https://nodejs.org/api/errors.html#err_unhandled_error | ||
* | ||
* @param {string?} [err=''] - Stringified error | ||
* @return {string} Error message | ||
*/ | ||
(err: string = ''): string => { | ||
/** | ||
* Creates an [`ERR_UNHANDLED_ERROR`][1] message. | ||
* Error message. | ||
* | ||
* [1]: https://nodejs.org/api/errors.html#err_unhandled_error | ||
* | ||
* @param {string?} [err=''] - Stringified error | ||
* @return {string} Error message | ||
* @const {string} message | ||
*/ | ||
(err: string = ''): string => { | ||
/** | ||
* Error message. | ||
* | ||
* @const {string} message | ||
*/ | ||
const message: string = 'Unhandled error.' | ||
const message: string = 'Unhandled error.' | ||
return err.length > 0 ? `${message} (${err})` : message | ||
} | ||
) | ||
return err.length > 0 ? `${message} (${err})` : message | ||
} | ||
) | ||
export default ERR_UNHANDLED_ERROR |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -24,7 +26,7 @@ /** | ||
* @param {string} name - Module name | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_UNKNOWN_BUILTIN_MODULE: NodeErrorConstructor< | ||
ErrorConstructor, | ||
[string] | ||
Error, | ||
Times<1, string> | ||
> = createNodeError( | ||
@@ -31,0 +33,0 @@ ErrorCode.ERR_UNKNOWN_BUILTIN_MODULE, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -22,7 +24,7 @@ /** | ||
* @param {string} encoding - Invalid or unknown encoding | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_UNKNOWN_ENCODING: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
[string] | ||
TypeError, | ||
Times<1, string> | ||
> = createNodeError( | ||
@@ -29,0 +31,0 @@ ErrorCode.ERR_UNKNOWN_ENCODING, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import { DOT } from '@flex-development/tutils' | ||
@@ -25,6 +27,6 @@ /** | ||
* @param {string?} [suggestion=''] - Recommended fix | ||
* @return {NodeError<TypeError>} `TypeError` instance | ||
* @return {NodeError<TypeError>} New `TypeError` instance | ||
*/ | ||
const ERR_UNKNOWN_FILE_EXTENSION: NodeErrorConstructor< | ||
TypeErrorConstructor, | ||
TypeError, | ||
MessageFn<[string, string, string?]> | ||
@@ -53,3 +55,3 @@ > = createNodeError( | ||
// add recommended fix | ||
if (suggestion) message += `. ${suggestion}` | ||
if (suggestion) message += `${DOT} ${suggestion}` | ||
@@ -56,0 +58,0 @@ return message |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -24,7 +26,7 @@ /** | ||
* @param {string} id - Id of module with `format` | ||
* @return {NodeError<RangeError>} `RangeError` instance | ||
* @return {NodeError<RangeError>} New `RangeError` instance | ||
*/ | ||
const ERR_UNKNOWN_MODULE_FORMAT: NodeErrorConstructor< | ||
RangeErrorConstructor, | ||
[string, string] | ||
RangeError, | ||
Times<2, string> | ||
> = createNodeError( | ||
@@ -31,0 +33,0 @@ ErrorCode.ERR_UNKNOWN_MODULE_FORMAT, |
@@ -8,4 +8,6 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import type { Times } from '@flex-development/tutils' | ||
@@ -23,18 +25,13 @@ /** | ||
* @param {string} base - Id of module `id` was imported from | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_UNSUPPORTED_DIR_IMPORT: NodeErrorConstructor< | ||
ErrorConstructor, | ||
[string, string] | ||
Error, | ||
Times<2, string> | ||
> = createNodeError( | ||
ErrorCode.ERR_UNSUPPORTED_DIR_IMPORT, | ||
Error, | ||
// needs mkbuild update => import '%s' is being picked up as import statement | ||
[ | ||
'Directory', | ||
'import', | ||
"'%s' is not supported resolving ES modules imported from %s" | ||
].join(' ') | ||
"Directory import '%s' is not supported resolving ES modules imported from %s" | ||
) | ||
export default ERR_UNSUPPORTED_DIR_IMPORT |
@@ -8,5 +8,7 @@ /** | ||
import { ErrorCode } from '#src/enums' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import formatList from '#src/internal/format-list' | ||
import type { NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { MessageFn, NodeError } from '#src/types' | ||
import { createNodeError } from '#src/utils' | ||
import { DOT } from '@flex-development/tutils' | ||
import type { URL } from 'node:url' | ||
@@ -27,7 +29,7 @@ | ||
* @param {boolean?} [windows=false] - Windows operating system? | ||
* @return {NodeError} `Error` instance | ||
* @return {NodeError} New `Error` instance | ||
*/ | ||
const ERR_UNSUPPORTED_ESM_URL_SCHEME: NodeErrorConstructor< | ||
ErrorConstructor, | ||
[URL, string[], boolean?] | ||
Error, | ||
MessageFn<[URL, string[], boolean?]> | ||
> = createNodeError( | ||
@@ -63,7 +65,7 @@ ErrorCode.ERR_UNSUPPORTED_ESM_URL_SCHEME, | ||
if (windows && url.protocol.length === 2) { | ||
message += '. On Windows, absolute paths must be valid file:// URLs' | ||
message += `${DOT} On Windows, absolute paths must be valid file:// URLs` | ||
} | ||
// add url scheme provided by user | ||
message += `. Received protocol '${url.protocol}'` | ||
message += `${DOT} Received protocol '${url.protocol}'` | ||
@@ -70,0 +72,0 @@ return message |
@@ -5,2 +5,4 @@ /** | ||
* @see https://nodejs.org/api/errors.html#nodejs-error-codes | ||
* | ||
* @todo review docs | ||
*/ | ||
@@ -7,0 +9,0 @@ |
@@ -6,12 +6,13 @@ /** | ||
import type { Fn } from '@flex-development/tutils' | ||
/** | ||
* Creates an error message. | ||
* Error message generator. | ||
* | ||
* @template Args - Function parameters type | ||
* @template A - Function parameters type | ||
* | ||
* @param {Args} args - Function parameters | ||
* @return {string} Error message | ||
*/ | ||
type MessageFn<Args extends any[] = any[]> = (...args: Args) => string | ||
type MessageFn<A extends readonly unknown[] = any[]> = Fn<A, string> | ||
export type { MessageFn as default } |
@@ -6,4 +6,5 @@ /** | ||
export type { default as ErrnodeConstructor } from './errnode-constructor' | ||
export type { default as MessageFn } from './fn-message' | ||
export type { default as Message } from './message' | ||
export type { default as NodeError } from './node-error' | ||
export type { default as NodeErrorConstructor } from './node-error-constructor' |
@@ -7,2 +7,3 @@ /** | ||
import type { ErrorCode } from '#src/enums' | ||
import type { Assign, Get } from '@flex-development/tutils' | ||
@@ -16,9 +17,14 @@ /** | ||
*/ | ||
type NodeError<T extends Error = Error> = T & { | ||
/** | ||
* Error code. | ||
*/ | ||
code: ErrorCode | ||
} | ||
type NodeError<T extends Error & { code?: ErrorCode } = Error> = Assign< | ||
T, | ||
{ | ||
/** | ||
* Node.js error code. | ||
* | ||
* @see {@linkcode ErrorCode} | ||
*/ | ||
code: Get<T, 'code', ErrorCode> | ||
} | ||
> | ||
export type { NodeError as default } |
@@ -8,6 +8,8 @@ /** | ||
import type { ErrorCode } from '#src/enums' | ||
import formatMessage from '#src/internal/format-message' | ||
import type { NodeErrorConstructor } from '#src/interfaces' | ||
import type { Args } from '#src/interfaces/node-error-constructor' | ||
import kIsNodeError from '#src/internal/k-is-node-error' | ||
import prepareStackTrace from '#src/internal/prepare-stack-trace' | ||
import type { MessageFn, NodeError, NodeErrorConstructor } from '#src/types' | ||
import type { ErrnodeConstructor, Message, MessageFn } from '#src/types' | ||
import { cast, define, isString, regexp } from '@flex-development/tutils' | ||
import { format } from 'node-inspect-extracted' | ||
@@ -17,60 +19,63 @@ /** | ||
* | ||
* If the given error `message` is a function, constructor arguments are passed | ||
* to `message`. If the `message` is a string, constructor arguments are passed | ||
* to [`util.format`][2] instead. | ||
* Constructor arguments are passed to [`util.format`][1] if the error `message` | ||
* is a string, or `message` itself if it is a function. Message functions will | ||
* also be called with the new Node.js error instance as `this`. | ||
* | ||
* [1]: {@link ./types/fn-message.ts} | ||
* [2]: https://nodejs.org/api/util.html#utilformatformat-args | ||
* [1]: https://nodejs.org/api/util.html#utilformatformat-args | ||
* | ||
* @see {@linkcode NodeErrorConstructor} | ||
* @see https://nodejs.org/api/util.html#utilformatformat-args | ||
* | ||
* @template B - Error base class type | ||
* @template M - Error message type, [`util.format`][2] arguments type, or | ||
* custom message function parameters type | ||
* @template T - Error base type | ||
* @template M - Error message function or `util.format` arguments | ||
* @template T - Error prototype | ||
* | ||
* @constructs NodeError<T> | ||
* | ||
* @param {ErrorCode} code - Node.js error code | ||
* @param {B} Base - Error base class | ||
* @param {M} message - Error message or message function | ||
* @return {NodeErrorConstructor<B, M>} `NodeError` constructor | ||
* @param {Message<M>} message - Error message string or function | ||
* @return {NodeErrorConstructor<T, M>} `NodeError` constructor | ||
*/ | ||
function createNodeError< | ||
B extends ErrorConstructor = ErrorConstructor, | ||
M extends any[] | MessageFn | string = MessageFn, | ||
T extends B['prototype'] = B['prototype'] | ||
>(code: ErrorCode, Base: B, message: M): NodeErrorConstructor<B, M, T> { | ||
/** | ||
* Creates a Node.js error. | ||
* | ||
* [1]: https://nodejs.org/api/util.html#utilformatformat-args | ||
* | ||
* @class | ||
* @implements {NodeError<T>} | ||
* | ||
* @param {any[] | M | Parameters<M>} args - `message` params if `message` is | ||
* a function; [`util.format`][1] arguments if `message` is a string | ||
* @return {NodeError<T>} Node.js error instance | ||
*/ | ||
function NodeError( | ||
...args: M extends MessageFn ? Parameters<M> : M extends any[] ? M : any[] | ||
): NodeError<T> { | ||
const createNodeError = < | ||
B extends ErrnodeConstructor, | ||
M extends MessageFn | string | readonly unknown[], | ||
T extends B['prototype'] | ||
>( | ||
code: ErrorCode, | ||
Base: B, | ||
message: Message<M> | ||
): NodeErrorConstructor<T, M> => { | ||
// @ts-expect-error ts(2322) | ||
return class NodeError extends Base { | ||
/** | ||
* Node.js error instance. | ||
* Node.js error code. | ||
* | ||
* @const {NodeError<T>} error | ||
* @public | ||
* @instance | ||
* @member {ErrorCode} | ||
*/ | ||
const error: NodeError<T> = new Base() as NodeError<T> | ||
public code!: ErrorCode | ||
// define error code | ||
// note: defined first to ensure `this.code` can be used in message function | ||
Object.defineProperty(error, 'code', { | ||
configurable: true, | ||
enumerable: true, | ||
value: code, | ||
writable: true | ||
}) | ||
/** | ||
* Creates a new Node.js error. | ||
* | ||
* @param {any[]} args - Error message function arguments | ||
*/ | ||
constructor(...args: any[]) { | ||
super() | ||
// define error symbol and message + redefine toString method | ||
Object.defineProperties(error, { | ||
[kIsNodeError]: { | ||
/** | ||
* Instance properties are defined in order of precedence. | ||
* | ||
* Precedence is determined by latter property definitions using the value | ||
* of former property definitions to generate a value. | ||
* | ||
* Instance property dependencies: | ||
* | ||
* - `message`: `code` | ||
* - `toString`: `code`, `message`, `name` | ||
* - `stack`: `toString` | ||
*/ | ||
// add error symbol | ||
define(this, kIsNodeError, { | ||
configurable: true, | ||
@@ -80,10 +85,22 @@ enumerable: false, | ||
writable: false | ||
}, | ||
message: { | ||
}) | ||
// add error code | ||
define(this, 'code', { | ||
configurable: true, | ||
enumerable: true, | ||
value: code, | ||
writable: true | ||
}) | ||
// add error message | ||
define(this, 'message', { | ||
configurable: true, | ||
enumerable: false, | ||
value: formatMessage(code, message, args, error), | ||
value: NodeError.#message(code, message, cast(args), this), | ||
writable: true | ||
}, | ||
toString: { | ||
}) | ||
// redefine toString method | ||
define(this, 'toString', { | ||
configurable: true, | ||
@@ -94,22 +111,113 @@ enumerable: false, | ||
* | ||
* @this {NodeError<T>} | ||
* @this {import('#src/types').NodeError} | ||
* | ||
* @return {string} String representation of error | ||
*/ | ||
value(this: NodeError<T>): string { | ||
value(this: NodeError): string { | ||
return `${this.name} [${this.code}]: ${this.message}` | ||
}, | ||
writable: true | ||
}) | ||
// add stack trace | ||
define(this, 'stack', { | ||
configurable: true, | ||
enumerable: true, | ||
value: NodeError.#prepareStackTrace(this), | ||
writable: true | ||
}) | ||
} | ||
/** | ||
* Creates an error message string. | ||
* | ||
* @see https://nodejs.org/api/util.html#utilformatformat-args | ||
* | ||
* @private | ||
* @static | ||
* | ||
* @param {ErrorCode} code - Node.js error code | ||
* @param {Message<M>} message - Error message function or format string | ||
* @param {Args<M>} args - Custom message function arguments if `message` is | ||
* a function, or `util.format` arguments if `message` is a string | ||
* @param {Error} self - Error object used as `this` argument | ||
* @return {string} Formatted error message | ||
* @throws {Error} If `args` length is invalid | ||
*/ | ||
static #message( | ||
code: ErrorCode, | ||
message: Message<M>, | ||
args: Args<M>, | ||
self: Error | ||
): string { | ||
/** | ||
* Invalid {@linkcode args} length error message. | ||
* | ||
* @var {string} error | ||
*/ | ||
let error: string = `${code};` + ' ' | ||
// check args.length against expected message function arguments length | ||
// default parameters do not count when message is a function | ||
if (isString(message)) { | ||
/** | ||
* {@linkcode format} specifiers regex. | ||
* | ||
* @const {RegExp} regex | ||
*/ | ||
const regex: RegExp = /%[Odfijos]/g | ||
/** | ||
* Expected message length. | ||
* | ||
* @var {number} length | ||
*/ | ||
let length: number = 0 | ||
// get expected message length | ||
while (regex.exec(message) !== null) length++ | ||
// throw if incorrect number of arguments are passed to util.format | ||
if (length !== args.length) { | ||
error += `The arguments length (${args.length}) provided to \`util.format\` does not match the required length (${length}).` | ||
throw new Error(error, { cause: args }) | ||
} | ||
} else if (!(message.length <= args.length)) { | ||
error += `The arguments length (${args.length}) provided to \`message\` does not match the required length (${message.length}).` | ||
throw new Error(error, { cause: args }) | ||
} | ||
}) | ||
// add stack trace | ||
prepareStackTrace(error) | ||
return Reflect.apply( | ||
isString(message) ? format : message, | ||
isString(message) ? null : self, | ||
isString(message) ? [message, ...args] : args | ||
) | ||
} | ||
return error | ||
/** | ||
* Adds a formatted stack trace to the given `error`. | ||
* | ||
* Previously written stack traces are not preserved. | ||
* | ||
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces | ||
* | ||
* @private | ||
* @static | ||
* | ||
* @param {Error} error - Error object to prepare stack trace for | ||
* @return {string} Formatted stack trace | ||
*/ | ||
static #prepareStackTrace(error: Error): string { | ||
// create stack property | ||
Base.captureStackTrace(error, NodeError.#prepareStackTrace) | ||
// format stack trace | ||
return error.stack!.replace( | ||
new RegExp(`^${error.name}: ${regexp(error.message)}`), | ||
error.toString() | ||
) | ||
} | ||
} | ||
return NodeError as NodeErrorConstructor<B, M, T> | ||
} | ||
export default createNodeError |
@@ -7,2 +7,11 @@ /** | ||
import { | ||
cast, | ||
isFunction, | ||
isNull, | ||
isObject, | ||
isUndefined, | ||
truncate, | ||
type Fn | ||
} from '@flex-development/tutils' | ||
import { inspect } from 'node-inspect-extracted' | ||
@@ -16,3 +25,3 @@ | ||
*/ | ||
function determineSpecificType(value: unknown): string { | ||
const determineSpecificType = (value: unknown): string => { | ||
/** | ||
@@ -26,6 +35,7 @@ * Specific type of `value`. | ||
switch (true) { | ||
case typeof value === 'function': | ||
type = `function ${(value as FunctionConstructor).name}` | ||
case isFunction(value): | ||
type = `function ${cast<Fn>(value).name}` | ||
break | ||
case typeof value === 'object': | ||
case isObject(value): | ||
case isNull(value): | ||
type = value?.constructor?.name | ||
@@ -35,3 +45,3 @@ ? `an instance of ${value.constructor.name}` | ||
break | ||
case typeof value === 'undefined': | ||
case isUndefined(value): | ||
type = typeof value | ||
@@ -47,4 +57,4 @@ break | ||
// trim string representation of value | ||
if (inspected.length > 28) inspected = inspected.slice(0, 25) + '...' | ||
// truncate inspected value | ||
if (inspected.length > 28) inspected = truncate(inspected, 28) | ||
@@ -51,0 +61,0 @@ type = `type ${typeof value} (${inspected})` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
335309
642
81
184
3897
+ Added@flex-development/tutils@6.0.0-alpha.12(transitive)
+ Addeddequal@2.0.3(transitive)
+ Addednode-inspect-extracted@2.0.2(transitive)
- Removed@flex-development/tutils@6.0.0-alpha.10(transitive)
- Removednode-inspect-extracted@2.0.0(transitive)
Updatednode-inspect-extracted@2.0.2