@thi.ng/errors 2.1.10 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2022-08-06T15:22:27Z
3
+ - **Last updated**: 2022-10-03T16:07:55Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,14 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/errors@2.2.0) (2022-09-21)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add I/O error types & factories ([898584b](https://github.com/thi-ng/umbrella/commit/898584b))
17
+ - add IOError
18
+ - add FileNotFoundError
19
+
12
20
  ## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/errors@2.1.0) (2021-11-17)
13
21
 
14
22
  #### 🚀 Features
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
2
 
3
- # ![errors](https://media.thi.ng/umbrella/banners/thing-errors.svg?f2f20b9e)
3
+ # ![errors](https://media.thi.ng/umbrella/banners-20220914/thing-errors.svg?e0537a6e)
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@thi.ng/errors.svg)](https://www.npmjs.com/package/@thi.ng/errors)
6
6
  ![npm downloads](https://img.shields.io/npm/dm/@thi.ng/errors.svg)
@@ -10,7 +10,7 @@ This project is part of the
10
10
  [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
11
11
 
12
12
  - [About](#about)
13
- - [Status](#status)
13
+ - [Status](#status)
14
14
  - [Installation](#installation)
15
15
  - [Dependencies](#dependencies)
16
16
  - [API](#api)
@@ -34,7 +34,7 @@ This package defines the following error types & helper functions to throw them:
34
34
  Custom error types can be easily defined using
35
35
  [`defError()`](https://github.com/thi-ng/umbrella/tree/develop/packages/errors/src/deferror.ts).
36
36
 
37
- ### Status
37
+ ## Status
38
38
 
39
39
  **STABLE** - used in production
40
40
 
@@ -63,7 +63,7 @@ node --experimental-repl-await
63
63
  > const errors = await import("@thi.ng/errors");
64
64
  ```
65
65
 
66
- Package sizes (gzipped, pre-treeshake): ESM: 546 bytes
66
+ Package sizes (gzipped, pre-treeshake): ESM: 608 bytes
67
67
 
68
68
  ## Dependencies
69
69
 
package/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./assert.js";
3
3
  export * from "./illegal-arguments.js";
4
4
  export * from "./illegal-arity.js";
5
5
  export * from "./illegal-state.js";
6
+ export * from "./io.js";
6
7
  export * from "./out-of-bounds.js";
7
8
  export * from "./unsupported.js";
8
9
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -3,5 +3,6 @@ export * from "./assert.js";
3
3
  export * from "./illegal-arguments.js";
4
4
  export * from "./illegal-arity.js";
5
5
  export * from "./illegal-state.js";
6
+ export * from "./io.js";
6
7
  export * from "./out-of-bounds.js";
7
8
  export * from "./unsupported.js";
package/io.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" />
2
+ export declare const IOError: {
3
+ new (msg?: any): {
4
+ name: string;
5
+ message: string;
6
+ stack?: string | undefined;
7
+ };
8
+ captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
9
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
10
+ stackTraceLimit: number;
11
+ };
12
+ export declare const ioerror: (msg?: any) => never;
13
+ export declare const FileNotFoundError: {
14
+ new (msg?: any): {
15
+ name: string;
16
+ message: string;
17
+ stack?: string | undefined;
18
+ };
19
+ captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
20
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
21
+ stackTraceLimit: number;
22
+ };
23
+ export declare const fileNotFound: (path: string) => never;
24
+ //# sourceMappingURL=io.d.ts.map
package/io.js ADDED
@@ -0,0 +1,9 @@
1
+ import { defError } from "./deferror.js";
2
+ export const IOError = defError(() => "IO error");
3
+ export const ioerror = (msg) => {
4
+ throw new IOError(msg);
5
+ };
6
+ export const FileNotFoundError = defError(() => "File not found");
7
+ export const fileNotFound = (path) => {
8
+ throw new FileNotFoundError(path);
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/errors",
3
- "version": "2.1.10",
3
+ "version": "2.2.1",
4
4
  "description": "Custom error types and error factory functions",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -34,13 +34,13 @@
34
34
  "test": "testament test"
35
35
  },
36
36
  "devDependencies": {
37
- "@microsoft/api-extractor": "^7.25.0",
38
- "@thi.ng/testament": "^0.2.11",
39
- "@types/node": "^18.6.4",
37
+ "@microsoft/api-extractor": "^7.31.1",
38
+ "@thi.ng/testament": "^0.3.1",
39
+ "@types/node": "^18.7.18",
40
40
  "rimraf": "^3.0.2",
41
41
  "tools": "^0.0.1",
42
42
  "typedoc": "^0.22.17",
43
- "typescript": "^4.7.4"
43
+ "typescript": "^4.8.3"
44
44
  },
45
45
  "keywords": [
46
46
  "assert",
@@ -80,6 +80,9 @@
80
80
  "./illegal-state": {
81
81
  "default": "./illegal-state.js"
82
82
  },
83
+ "./io": {
84
+ "default": "./io.js"
85
+ },
83
86
  "./out-of-bounds": {
84
87
  "default": "./out-of-bounds.js"
85
88
  },
@@ -90,5 +93,5 @@
90
93
  "thi.ng": {
91
94
  "year": 2018
92
95
  },
93
- "gitHead": "01b7a47077d88c2aefe77650ce3340040bae00ee\n"
96
+ "gitHead": "8600007d81a7dc92634a1d54e2c32b14ab30ba80\n"
94
97
  }