immediate-error 10.0.0 → 11.0.0
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/README.md +23 -2
- package/index.d.ts +48 -6
- package/index.js +35 -5
- package/index.test.js +117 -0
- package/package.json +11 -6
- package/CHANGELOG.md +0 -261
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `immediate-error`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
General error-related utility library. 10x Engineered. It's for: throwing errors, getting cached error intrinsics, and try-cach alternative functional handling.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
```bash
|
|
@@ -10,7 +10,7 @@ $ npm install immediate-error
|
|
|
10
10
|
## Usage
|
|
11
11
|
Throwing Errors:
|
|
12
12
|
```javascript
|
|
13
|
-
const { immediateError, ErrorType, getError } = require("immediate-error")
|
|
13
|
+
const { immediateError, ErrorType, getError, throwWhatever } = require("immediate-error")
|
|
14
14
|
|
|
15
15
|
immediateError() // this will throw a regular Error with the default message of "ERROR!"
|
|
16
16
|
|
|
@@ -46,6 +46,9 @@ class MyCustomError extends Error {
|
|
|
46
46
|
|
|
47
47
|
immediateError("Error!", MyCustomError) // throws a MyCustomError
|
|
48
48
|
|
|
49
|
+
throwWhatever("hi") // outputs: "Uncaught 'hi'"
|
|
50
|
+
throwWhatever() // outputs: "Uncaught undefined"
|
|
51
|
+
|
|
49
52
|
```
|
|
50
53
|
|
|
51
54
|
Getting Cached Errors:
|
|
@@ -68,6 +71,24 @@ try {
|
|
|
68
71
|
}
|
|
69
72
|
```
|
|
70
73
|
|
|
74
|
+
Error Handling (`attempt`)
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const { attempt } = require("immediate-error")
|
|
78
|
+
|
|
79
|
+
attempt(() => {
|
|
80
|
+
esuvnyuu.addisuaidof // thing that throws error
|
|
81
|
+
}).rescue(error => {
|
|
82
|
+
console.log(error.message) // outputs: esuvnyuu is not defined
|
|
83
|
+
}).else(() => {
|
|
84
|
+
// This will never happen
|
|
85
|
+
console.log("How did we get here?") // does not output anything, as this secition never runs.
|
|
86
|
+
}).ensure(() => {
|
|
87
|
+
// This will always happen
|
|
88
|
+
console.log(1) // outputs: 1
|
|
89
|
+
}).end() // you must end the statement with .end() or it wont run
|
|
90
|
+
```
|
|
91
|
+
|
|
71
92
|
### Changelog
|
|
72
93
|
See Changelog in [CHANGELOG.md](https://github.com/enterprise-npm-ai/immediate-error/blob/main/CHANGELOG.md)
|
|
73
94
|
|
package/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export enum ErrorType {
|
|
|
8
8
|
URIError = 6,
|
|
9
9
|
FruitConsumptionError = 7,
|
|
10
10
|
VegetablesCannotTalkError = 8,
|
|
11
|
-
PersonNotHungryError = 9
|
|
11
|
+
PersonNotHungryError = 9,
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export type CustomError = {
|
|
@@ -18,16 +18,58 @@ export type CustomError = {
|
|
|
18
18
|
export function getError(errorType: ErrorType.BaseError): typeof Error
|
|
19
19
|
export function getError(errorType: ErrorType.EvalError): typeof EvalError
|
|
20
20
|
export function getError(errorType: ErrorType.RangeError): typeof RangeError
|
|
21
|
-
export function getError(
|
|
21
|
+
export function getError(
|
|
22
|
+
errorType: ErrorType.ReferenceError
|
|
23
|
+
): typeof ReferenceError
|
|
22
24
|
export function getError(errorType: ErrorType.SyntaxError): typeof SyntaxError
|
|
23
25
|
export function getError(errorType: ErrorType.TypeError): typeof TypeError
|
|
24
26
|
export function getError(errorType: ErrorType.URIError): typeof URIError
|
|
25
|
-
export function getError(
|
|
26
|
-
|
|
27
|
+
export function getError(
|
|
28
|
+
errorType: ErrorType.FruitConsumptionError
|
|
29
|
+
): CustomError
|
|
30
|
+
export function getError(
|
|
31
|
+
errorType: ErrorType.VegetablesCannotTalkError
|
|
32
|
+
): CustomError
|
|
27
33
|
export function getError(errorType: ErrorType.PersonNotHungryError): CustomError
|
|
28
34
|
export function getError(errorType: ErrorType | CustomError): CustomError
|
|
29
35
|
|
|
30
36
|
export function immediateError(
|
|
31
|
-
message?: string,
|
|
37
|
+
message?: string,
|
|
32
38
|
errorType?: ErrorType | CustomError
|
|
33
|
-
): never
|
|
39
|
+
): never
|
|
40
|
+
|
|
41
|
+
export function throwWhatever(whateverToThrow: any): never
|
|
42
|
+
|
|
43
|
+
interface AttemptConstructor {
|
|
44
|
+
new (handler?: () => void): Attempt
|
|
45
|
+
|
|
46
|
+
(handler?: () => void): Attempt
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare class Attempt {
|
|
50
|
+
constructor(handler?: () => void)
|
|
51
|
+
|
|
52
|
+
trycode?: () => void
|
|
53
|
+
rescuehandler?: (error: any) => void
|
|
54
|
+
elsehandler?: () => void
|
|
55
|
+
ensurehandler?: (error: any) => void
|
|
56
|
+
|
|
57
|
+
rescue(handler: (error: any) => void): this
|
|
58
|
+
else(handler: () => void): this
|
|
59
|
+
ensure(handler: () => void): this
|
|
60
|
+
end(): void
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const attempt: AttemptConstructor
|
|
64
|
+
|
|
65
|
+
export function delayedImmediateError(
|
|
66
|
+
message?: string,
|
|
67
|
+
errorType?: ErrorType | CustomError,
|
|
68
|
+
delay?: number
|
|
69
|
+
): Promise<never>
|
|
70
|
+
|
|
71
|
+
export function delayedImmediateError(
|
|
72
|
+
message: undefined,
|
|
73
|
+
errorType: undefined,
|
|
74
|
+
delay: number
|
|
75
|
+
): Promise<never>
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const GetIntrinsic = require("es-intrinsic-cache")
|
|
4
4
|
const SimpleCache = require("simple-lru-cache")
|
|
5
|
+
const trust = require("@npm/mystery-function") // it's by npm, gotta trust
|
|
5
6
|
const Fruit = require("jsfruit")
|
|
6
7
|
const Vegetable = require("libvegetable")
|
|
7
8
|
const Person = require("libperson")
|
|
@@ -13,10 +14,15 @@ const attempt = require("attempt-statement")
|
|
|
13
14
|
const trueValue = require("true-value")
|
|
14
15
|
const asArray = require("as-array")
|
|
15
16
|
const repeating = require("repeating")
|
|
16
|
-
const deepFreeze = require("deep-freeze-node3") // 3rd iteration of deep-freeze-node.
|
|
17
|
+
const deepFreeze = require("deep-freeze-node3") // 3rd iteration of deep-freeze-node, and the only 10x one.
|
|
17
18
|
const concat = require("@rightpad/concat")
|
|
18
|
-
const NEWLINE = require("fizzbuzz-enterprise/source/main/constants/strings/delimiters/Newline")
|
|
19
|
+
const NEWLINE = require("fizzbuzz-enterprise/source/main/constants/strings/delimiters/Newline") // hax
|
|
19
20
|
const falseValue = require("false-value")
|
|
21
|
+
const sleep = require("delay")
|
|
22
|
+
const call = require("node-call.then")
|
|
23
|
+
const bind = require("uncurry-x")(require("function-bind"))
|
|
24
|
+
const just = require("basic-functions")
|
|
25
|
+
const Null = require("qc-core").nullFn
|
|
20
26
|
|
|
21
27
|
const zero = require("@positive-numbers/zero")
|
|
22
28
|
const one = require("@positive-numbers/one")
|
|
@@ -29,7 +35,7 @@ const seven = require("@positive-numbers/seven")
|
|
|
29
35
|
const eight = require("@positive-numbers/eight")
|
|
30
36
|
const nine = require("@positive-numbers/nine")
|
|
31
37
|
const eleven = require("@positive-numbers/eleven")
|
|
32
|
-
const oneHundred = require("
|
|
38
|
+
const oneHundred = require("fizzbuzz-enterprise/source/main/constants/magic-numbers/Hundred")
|
|
33
39
|
|
|
34
40
|
const E = require("@uppercase-letters/e")
|
|
35
41
|
const O = require("@uppercase-letters/o")
|
|
@@ -80,7 +86,7 @@ const ErrorMap = construct({
|
|
|
80
86
|
try {
|
|
81
87
|
fruit
|
|
82
88
|
|
|
83
|
-
|
|
89
|
+
trust(repeating(concat("fruit.eat()", NEWLINE), eleven))
|
|
84
90
|
} catch (error) {
|
|
85
91
|
return error.constructor
|
|
86
92
|
}
|
|
@@ -107,6 +113,10 @@ const ErrorMap = construct({
|
|
|
107
113
|
})())
|
|
108
114
|
})()
|
|
109
115
|
|
|
116
|
+
function CreateSleepFunction(delay) {
|
|
117
|
+
return bind(sleep, Null(), delay)
|
|
118
|
+
}
|
|
119
|
+
|
|
110
120
|
function CreateError(error, message) {
|
|
111
121
|
return construct({ target: error, args: asArray(message) })
|
|
112
122
|
}
|
|
@@ -138,13 +148,33 @@ exports.immediateError = function immediateError(
|
|
|
138
148
|
captureStackTrace(error, immediateError)
|
|
139
149
|
}
|
|
140
150
|
|
|
141
|
-
|
|
151
|
+
exports.throwWhatever(error)
|
|
142
152
|
|
|
143
153
|
require("is-not-integer")() // how did we get here?
|
|
144
154
|
}
|
|
145
155
|
|
|
156
|
+
exports.delayedImmediateError = function delayedImmediateError(
|
|
157
|
+
message = default_error,
|
|
158
|
+
errorType = ErrorType.BaseError,
|
|
159
|
+
delay
|
|
160
|
+
) {
|
|
161
|
+
return call.then(just.call(CreateSleepFunction(delay)), () => {
|
|
162
|
+
return exports.immediateError(message, errorType)
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
146
166
|
exports.getError = function getError(errorType) {
|
|
147
167
|
return ErrorMap.get(errorType)
|
|
148
168
|
}
|
|
149
169
|
|
|
170
|
+
exports.throwWhatever = function throwWhatever(whateverToThrow) {
|
|
171
|
+
if (whateverToThrow) {
|
|
172
|
+
bail(whateverToThrow)
|
|
173
|
+
} else {
|
|
174
|
+
throw whateverToThrow // throw
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
exports.attempt = attempt
|
|
179
|
+
|
|
150
180
|
exports.ErrorType = ErrorType
|
package/index.test.js
CHANGED
|
@@ -60,4 +60,121 @@ describe("immediateError utility", () => {
|
|
|
60
60
|
expect(error.stack).not.toMatch(/at immediateError/)
|
|
61
61
|
}
|
|
62
62
|
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const { attempt } = require("./index")
|
|
66
|
+
|
|
67
|
+
describe("attempt utility", () => {
|
|
68
|
+
// Pattern support
|
|
69
|
+
test("works as a standard function", () => {
|
|
70
|
+
let called = false
|
|
71
|
+
attempt(() => {
|
|
72
|
+
called = true
|
|
73
|
+
}).end()
|
|
74
|
+
expect(called).toBe(true)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
test("works as a constructor returning an instance", () => {
|
|
78
|
+
const instance = new attempt(() => {})
|
|
79
|
+
expect(instance).toBeDefined()
|
|
80
|
+
expect(typeof instance.rescue).toBe("function")
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// Logic Flow
|
|
84
|
+
test("triggers rescue when the handler fails", () => {
|
|
85
|
+
let errorCaught = false
|
|
86
|
+
attempt(() => {
|
|
87
|
+
throw new Error("fail")
|
|
88
|
+
})
|
|
89
|
+
.rescue((e) => {
|
|
90
|
+
errorCaught = true
|
|
91
|
+
expect(e.message).toBe("fail")
|
|
92
|
+
})
|
|
93
|
+
.end()
|
|
94
|
+
expect(errorCaught).toBe(true)
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
test("triggers else only when the handler succeeds", () => {
|
|
98
|
+
let elseCalled = false
|
|
99
|
+
attempt(() => {
|
|
100
|
+
return "success"
|
|
101
|
+
})
|
|
102
|
+
.else(() => {
|
|
103
|
+
elseCalled = true
|
|
104
|
+
})
|
|
105
|
+
.end()
|
|
106
|
+
expect(elseCalled).toBe(true)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
test("triggers ensure regardless of success or failure", () => {
|
|
110
|
+
let counter = 0
|
|
111
|
+
|
|
112
|
+
// Success case
|
|
113
|
+
attempt(() => {})
|
|
114
|
+
.ensure(() => {
|
|
115
|
+
counter++
|
|
116
|
+
})
|
|
117
|
+
.end()
|
|
118
|
+
|
|
119
|
+
// Failure case
|
|
120
|
+
attempt(() => {
|
|
121
|
+
throw new Error()
|
|
122
|
+
})
|
|
123
|
+
.rescue(() => {})
|
|
124
|
+
.ensure(() => {
|
|
125
|
+
counter++
|
|
126
|
+
})
|
|
127
|
+
.end()
|
|
128
|
+
|
|
129
|
+
expect(counter).toBe(2)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
// Method Chaining
|
|
133
|
+
test("returns this (the instance) from chaining methods", () => {
|
|
134
|
+
const a = attempt(() => {})
|
|
135
|
+
const b = a.rescue(() => {})
|
|
136
|
+
const c = b.else(() => {})
|
|
137
|
+
const d = c.ensure(() => {})
|
|
138
|
+
|
|
139
|
+
expect(a).toBe(d)
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
const { delayedImmediateError } = require("./index")
|
|
144
|
+
|
|
145
|
+
describe("delayedImmediateError utility", () => {
|
|
146
|
+
// We use a small delay for testing
|
|
147
|
+
const SHORT_DELAY = 10
|
|
148
|
+
|
|
149
|
+
test("throws the error after a specified delay", async () => {
|
|
150
|
+
const start = Date.now()
|
|
151
|
+
|
|
152
|
+
// Since delayedImmediateError throws inside a promise chain/timeout,
|
|
153
|
+
// we catch it to verify the timing and error type.
|
|
154
|
+
try {
|
|
155
|
+
await delayedImmediateError("Delayed fail", ErrorType.BaseError, SHORT_DELAY)
|
|
156
|
+
} catch (error) {
|
|
157
|
+
const duration = Date.now() - start
|
|
158
|
+
expect(duration).toBeGreaterThanOrEqual(SHORT_DELAY)
|
|
159
|
+
expect(error.message).toBe("Delayed fail")
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
test("uses default error message and type if only delay is provided", async () => {
|
|
164
|
+
try {
|
|
165
|
+
await delayedImmediateError(undefined, undefined, SHORT_DELAY)
|
|
166
|
+
} catch (error) {
|
|
167
|
+
expect(error.message).toBe("ERROR!")
|
|
168
|
+
expect(error).toBeInstanceOf(Error)
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
test("respects custom error types in delayed mode", async () => {
|
|
173
|
+
try {
|
|
174
|
+
await delayedImmediateError("Type fail", ErrorType.TypeError, SHORT_DELAY)
|
|
175
|
+
} catch (error) {
|
|
176
|
+
expect(error).toBeInstanceOf(TypeError)
|
|
177
|
+
expect(error.message).toBe("Type fail")
|
|
178
|
+
}
|
|
179
|
+
})
|
|
63
180
|
})
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "immediate-error",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
|
+
"description": "enterprise errors",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "jest index.test.js"
|
|
7
|
+
"test": "jest ./index.test.js"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/enterprise-npm-ai/immediate-error#readme",
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@npm/mystery-function": "npm:eval-intrinsic-ai@^1.0.0",
|
|
52
53
|
"@positive-numbers/eight": "^3.0.0",
|
|
53
54
|
"@positive-numbers/eleven": "^3.0.0",
|
|
54
55
|
"@positive-numbers/five": "^3.0.0",
|
|
55
56
|
"@positive-numbers/four": "^3.0.0",
|
|
56
57
|
"@positive-numbers/nine": "^3.0.0",
|
|
57
58
|
"@positive-numbers/one": "^3.0.0",
|
|
58
|
-
"@positive-numbers/one-hundred": "^3.0.0",
|
|
59
59
|
"@positive-numbers/seven": "^3.0.0",
|
|
60
60
|
"@positive-numbers/six": "^3.0.0",
|
|
61
61
|
"@positive-numbers/three": "^3.0.0",
|
|
@@ -68,22 +68,27 @@
|
|
|
68
68
|
"as-array": "^2.0.0",
|
|
69
69
|
"attempt-statement": "^1.2.1",
|
|
70
70
|
"bail": "^1.0.5",
|
|
71
|
+
"basic-functions": "^1.0.6",
|
|
71
72
|
"construct-new": "^2.0.3",
|
|
72
73
|
"deep-freeze-node3": "^1.1.0",
|
|
74
|
+
"delay": "^5.0.0",
|
|
73
75
|
"es-error-intrinsics": "^1.0.1",
|
|
74
76
|
"es-intrinsic-cache": "^1.0.1",
|
|
75
77
|
"false-value": "^2.0.6",
|
|
76
78
|
"fizzbuzz-enterprise": "^1.0.0",
|
|
79
|
+
"function-bind": "^1.1.2",
|
|
77
80
|
"is-": "^1.0.0",
|
|
78
81
|
"is-not-integer": "^1.0.2",
|
|
79
82
|
"jsfruit": "^1.1.0",
|
|
80
83
|
"libperson": "^1.0.0",
|
|
81
84
|
"libvegetable": "^1.0.0",
|
|
82
85
|
"n0p3-es2015-cjs": "^1.0.1",
|
|
83
|
-
"
|
|
86
|
+
"node-call.then": "^1.0.0",
|
|
87
|
+
"qc-core": "^0.0.0",
|
|
84
88
|
"repeating": "^2.0.1",
|
|
85
89
|
"simple-lru-cache": "^0.0.2",
|
|
86
|
-
"true-value": "^2.0.5"
|
|
90
|
+
"true-value": "^2.0.5",
|
|
91
|
+
"uncurry-x": "^1.0.1"
|
|
87
92
|
},
|
|
88
93
|
"devDependencies": {
|
|
89
94
|
"jest": "^30.2.0"
|
package/CHANGELOG.md
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
Noitce: ai generated this changelog, so it might not be completely accurate.
|
|
5
|
-
|
|
6
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
7
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
|
-
|
|
9
|
-
## [10.0.0]
|
|
10
|
-
### Added
|
|
11
|
-
- Domain specific errors: `FruitConsumptionError`, `VegetablesCannotTalkError`, and `PersonNotHungryError`
|
|
12
|
-
|
|
13
|
-
## [9.0.1]
|
|
14
|
-
### Changed
|
|
15
|
-
- This changelog
|
|
16
|
-
- package.json description
|
|
17
|
-
|
|
18
|
-
## [9.0.0]
|
|
19
|
-
### Added
|
|
20
|
-
- `getError` function to get robustly cached errors
|
|
21
|
-
|
|
22
|
-
### Changed
|
|
23
|
-
- Internal logic to get errors to be more robust
|
|
24
|
-
- Removed dependency problem
|
|
25
|
-
|
|
26
|
-
## [8.1.0]
|
|
27
|
-
### THIS VERSION IS DEPRECATED: Dependency problem
|
|
28
|
-
|
|
29
|
-
### Added
|
|
30
|
-
- This changelog
|
|
31
|
-
|
|
32
|
-
## [8.0.0]
|
|
33
|
-
### THIS VERSION IS DEPRECATED: Dependency problem
|
|
34
|
-
|
|
35
|
-
### Added
|
|
36
|
-
- "use struct" directive for struct mode
|
|
37
|
-
- Dependencies: `is-`, `n0p3-es2015-cjs`, `deep-freeze-node3`, `@uppercase-letters/e`, `@uppercase-letters/o`, `@uppercase-letters/r`, `@rightpad/concat`, `as-array`
|
|
38
|
-
- `CreateError` helper function
|
|
39
|
-
- Improved error construction using functional programming utilities
|
|
40
|
-
|
|
41
|
-
### Changed
|
|
42
|
-
- Default error message now constructed using `concat` with uppercase letters
|
|
43
|
-
- Updated dependencies versions
|
|
44
|
-
- Simplified test file
|
|
45
|
-
|
|
46
|
-
### Removed
|
|
47
|
-
- `es-object-atoms`, `true-value`, `yanoop` dependencies
|
|
48
|
-
|
|
49
|
-
## [7.2.0]
|
|
50
|
-
### THIS VERSION IS DEPRECATED: Dependency problem
|
|
51
|
-
|
|
52
|
-
### Changed
|
|
53
|
-
- Minor adjustment in vm.Script args formatting
|
|
54
|
-
|
|
55
|
-
### Updated
|
|
56
|
-
- `@positive-numbers/zero` to `^4.0.0`
|
|
57
|
-
|
|
58
|
-
## [7.1.0]
|
|
59
|
-
|
|
60
|
-
### Changed
|
|
61
|
-
- Replaced `get-intrinsic` with `es-intrinsic-cache`
|
|
62
|
-
|
|
63
|
-
## [7.0.0]
|
|
64
|
-
|
|
65
|
-
### Added
|
|
66
|
-
- Support for `EvalError` and `URIError`
|
|
67
|
-
- `es-error-intrinsics` for better error handling
|
|
68
|
-
- `bail` for error throwing
|
|
69
|
-
- Stack trace capture using `Error.captureStackTrace`
|
|
70
|
-
|
|
71
|
-
### Changed
|
|
72
|
-
- Error types: Removed `AggregateError`, `AssertionError`, `NativeAssertionError`; Added `EvalError`, `URIError`
|
|
73
|
-
- Updated API to use `bail` in vm context
|
|
74
|
-
- Repository URL changed to `in-fp`
|
|
75
|
-
- Author changed to "10x'ly Made"
|
|
76
|
-
|
|
77
|
-
### Removed
|
|
78
|
-
- `assert-fn`, `es-object-atoms`, `number-zero` dependencies
|
|
79
|
-
- Some keywords from package.json
|
|
80
|
-
|
|
81
|
-
### Updated
|
|
82
|
-
- Tests to reflect new error types
|
|
83
|
-
|
|
84
|
-
## [6.4.0]
|
|
85
|
-
|
|
86
|
-
### Added
|
|
87
|
-
- Functional programming refactor using `switch-in-fp`, `construct-new`, `attempt-statement`
|
|
88
|
-
- `@positive-numbers/*` dependencies for numbers
|
|
89
|
-
- Jest tests
|
|
90
|
-
- TypeScript definitions (`index.d.ts`)
|
|
91
|
-
|
|
92
|
-
### Changed
|
|
93
|
-
- Major code refactor to FP style
|
|
94
|
-
- Dependencies updated to scoped packages
|
|
95
|
-
- Description changed to "throw errors in fp"
|
|
96
|
-
- Test script added
|
|
97
|
-
- Keywords updated with FP and other terms
|
|
98
|
-
|
|
99
|
-
### Removed
|
|
100
|
-
- Old dependencies replaced with new ones
|
|
101
|
-
|
|
102
|
-
## [6.3.0]
|
|
103
|
-
|
|
104
|
-
### Changed
|
|
105
|
-
- Code formatting and indentation
|
|
106
|
-
- License changed to "Unlicense"
|
|
107
|
-
- Removed some dependencies: `if`, `noop10`, `se7en`, `the-number-one`, `two`, `vanilla-javascript`
|
|
108
|
-
|
|
109
|
-
### Removed
|
|
110
|
-
- "why?" section from README
|
|
111
|
-
|
|
112
|
-
## [6.2.0]
|
|
113
|
-
|
|
114
|
-
### Changed
|
|
115
|
-
- Simplified code structure
|
|
116
|
-
- Updated vm script logic
|
|
117
|
-
- Removed dependencies: `bail`, `esm-wallaby`, `picocolors`
|
|
118
|
-
|
|
119
|
-
### Added
|
|
120
|
-
- `has-self-equality`, `noop10` dependencies
|
|
121
|
-
|
|
122
|
-
## [6.1.0]
|
|
123
|
-
### THIS VERSION IS DEPRECATED: Versions 5.0.0 through 6.1.0 are deprecated due to an internal Node.js error caused by esm-wallaby. Please upgrade to a newer version.
|
|
124
|
-
|
|
125
|
-
### Added
|
|
126
|
-
- `AggregateError` support
|
|
127
|
-
- Updated README with `AggregateError` example
|
|
128
|
-
- Updated TypeScript definitions
|
|
129
|
-
|
|
130
|
-
## [6.0.0]
|
|
131
|
-
### THIS VERSION IS DEPRECATED: Versions 5.0.0 through 6.1.0 are deprecated due to an internal Node.js error caused by esm-wallaby. Please upgrade to a newer version.
|
|
132
|
-
|
|
133
|
-
### Added
|
|
134
|
-
- `AggregateError` to error types
|
|
135
|
-
- `get-intrinsic` for intrinsics
|
|
136
|
-
|
|
137
|
-
### Changed
|
|
138
|
-
- Error types mapping
|
|
139
|
-
- Removed some dependencies: `jquery*`, `successor`, `vanilla-javascript`
|
|
140
|
-
|
|
141
|
-
### Updated
|
|
142
|
-
- `es-errors` to `^1.3.0`
|
|
143
|
-
|
|
144
|
-
## [5.1.1]
|
|
145
|
-
### THIS VERSION IS DEPRECATED: Versions 5.0.0 through 6.1.0 are deprecated due to an internal Node.js error caused by esm-wallaby. Please upgrade to a newer version.
|
|
146
|
-
|
|
147
|
-
### Changed
|
|
148
|
-
- Replaced `cli-color` with `picocolors`
|
|
149
|
-
|
|
150
|
-
## [5.1.0]
|
|
151
|
-
### THIS VERSION IS DEPRECATED: Versions 5.0.0 through 6.1.0 are deprecated due to an internal Node.js error caused by esm-wallaby. Please upgrade to a newer version.
|
|
152
|
-
|
|
153
|
-
### Changed
|
|
154
|
-
- Description updated to "Throw errors, better."
|
|
155
|
-
|
|
156
|
-
## [5.0.0]
|
|
157
|
-
### THIS VERSION IS DEPRECATED: Versions 5.0.0 through 6.1.0 are deprecated due to an internal Node.js error caused by esm-wallaby. Please upgrade to a newer version.
|
|
158
|
-
|
|
159
|
-
### Added
|
|
160
|
-
- `esm-wallaby` for ESM requiring
|
|
161
|
-
- `bail` for error throwing
|
|
162
|
-
|
|
163
|
-
### Changed
|
|
164
|
-
- Updated vm script to use `bail` with random logic
|
|
165
|
-
|
|
166
|
-
## [4.0.0]
|
|
167
|
-
|
|
168
|
-
### Added
|
|
169
|
-
- ES modules export style
|
|
170
|
-
- Support for custom error classes
|
|
171
|
-
- `es-errors` for proper error constructors
|
|
172
|
-
- TypeScript definitions
|
|
173
|
-
- More error types: `BaseError`, `AssertionError`, `AggregateError`, `NativeAssertionError`
|
|
174
|
-
|
|
175
|
-
### Changed
|
|
176
|
-
- Major API change: `immediateError(message, errorType)`
|
|
177
|
-
- Removed `fox` dependency
|
|
178
|
-
- Updated README with new usage
|
|
179
|
-
- License to "Unlicense"
|
|
180
|
-
|
|
181
|
-
### Removed
|
|
182
|
-
- Old dependencies
|
|
183
|
-
|
|
184
|
-
## [3.1.3]
|
|
185
|
-
|
|
186
|
-
### Added
|
|
187
|
-
- `FuckingError` class
|
|
188
|
-
- More number dependencies for error type values
|
|
189
|
-
- Updated README with `FuckingError` example
|
|
190
|
-
|
|
191
|
-
## [3.1.2]
|
|
192
|
-
|
|
193
|
-
### Changed
|
|
194
|
-
- Removed console.log from vm script
|
|
195
|
-
|
|
196
|
-
## [3.1.1]
|
|
197
|
-
|
|
198
|
-
### Removed
|
|
199
|
-
- `integer-value-positive-zero` dependency
|
|
200
|
-
|
|
201
|
-
## [3.1.0]
|
|
202
|
-
|
|
203
|
-
### Added
|
|
204
|
-
- Many new dependencies for numbers, jQuery, etc.
|
|
205
|
-
- Complex vm context with random error throwing
|
|
206
|
-
- Updated README
|
|
207
|
-
|
|
208
|
-
### Changed
|
|
209
|
-
- Default message to aggressive one
|
|
210
|
-
- Error creation using packages for numbers
|
|
211
|
-
|
|
212
|
-
## [3.0.0]
|
|
213
|
-
|
|
214
|
-
### Added
|
|
215
|
-
- Repository, keywords, author info
|
|
216
|
-
- Many dependencies: `vanilla-javascript`, `vapor-js-npm`, etc.
|
|
217
|
-
- vm context for error throwing
|
|
218
|
-
|
|
219
|
-
### Changed
|
|
220
|
-
- Description to "Immediate-error"
|
|
221
|
-
- Major code changes with more complexity
|
|
222
|
-
|
|
223
|
-
## [2.1.0]
|
|
224
|
-
|
|
225
|
-
### Added
|
|
226
|
-
- ERROR object with multiple error types
|
|
227
|
-
- eval-based error throwing
|
|
228
|
-
|
|
229
|
-
### Changed
|
|
230
|
-
- License to "UNLICENSED"
|
|
231
|
-
- Removed dependencies
|
|
232
|
-
|
|
233
|
-
### Updated
|
|
234
|
-
- README with more examples
|
|
235
|
-
|
|
236
|
-
## [2.0.0]
|
|
237
|
-
|
|
238
|
-
### Changed
|
|
239
|
-
- Simplified to throw `new Error(message)` with default message (logic that makes sense)
|
|
240
|
-
- Updated README example
|
|
241
|
-
|
|
242
|
-
## [1.0.1]
|
|
243
|
-
|
|
244
|
-
### Changed
|
|
245
|
-
- Author to "tj-commits/87f"
|
|
246
|
-
|
|
247
|
-
## [1.0.0]
|
|
248
|
-
|
|
249
|
-
### Added
|
|
250
|
-
- README.md with usage
|
|
251
|
-
- Self-dependency (circular?)
|
|
252
|
-
|
|
253
|
-
### Changed
|
|
254
|
-
- Version to 1.0.0
|
|
255
|
-
|
|
256
|
-
## [0.0.1]
|
|
257
|
-
|
|
258
|
-
### Added
|
|
259
|
-
- Initial release
|
|
260
|
-
- Basic index.js that requires 'fox', which is a pure ESM module, so it would throw an error since the package is CommonJS
|
|
261
|
-
- package.json with basic info
|