Skip to content

Commit e0b6005

Browse files
committed
Add error code database package
1 parent eb50b90 commit e0b6005

File tree

15 files changed

+1236
-0
lines changed

15 files changed

+1236
-0
lines changed

lib/node_modules/@stdlib/error/tools/database/LICENSE

+356
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2022 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# Error Database
22+
23+
> Standard library error code database.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var database = require( '@stdlib/error/tools/database' );
31+
```
32+
33+
#### database()
34+
35+
Returns a mapping of standard library error codes to their corresponding error messages.
36+
37+
```javascript
38+
var db = database();
39+
// returns {...}
40+
```
41+
42+
</section>
43+
44+
<!-- /.usage -->
45+
46+
<section class="examples">
47+
48+
<!-- TODO: more creative example. -->
49+
50+
## Examples
51+
52+
<!-- eslint no-undef: "error" -->
53+
54+
```javascript
55+
var invertObject = require( '@stdlib/utils/object-inverse' );
56+
var replace = require( '@stdlib/string/replace' );
57+
var database = require( '@stdlib/error/tools/database' );
58+
59+
var db = database();
60+
var errorMap = invertObject( db );
61+
var RE_ERR_MSG = /Error\( '([^']+)' \)/;
62+
63+
var code = 'throw new Error( \'insufficient input arguments. Must provide at least one iterator function.\' );';
64+
var transformed = replace( code, RE_ERR_MSG, replacer );
65+
// returns 'throw new Error( formatProdErrorMessage( \'04\' ) );'
66+
67+
function replacer( match, p1 ) {
68+
console.log( p1 );
69+
return 'Error( formatProdErrorMessage( \'' + errorMap[ p1 ] + '\' ) )';
70+
}
71+
```
72+
73+
</section>
74+
75+
<!-- /.examples -->
76+
77+
<!-- <license> -->
78+
79+
## License
80+
81+
The data files (databases) are licensed under an [Open Data Commons Public Domain Dedication & License 1.0][pddl-1.0] and their contents are licensed under [Creative Commons Zero v1.0 Universal][cc0]. The software is licensed under [Apache License, Version 2.0][apache-license].
82+
83+
<!-- </license> -->
84+
85+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
86+
87+
<section class="related">
88+
89+
</section>
90+
91+
<!-- /.related -->
92+
93+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
94+
95+
<section class="links">
96+
97+
[pddl-1.0]: http://opendatacommons.org/licenses/pddl/1.0/
98+
99+
[cc0]: https://creativecommons.org/publicdomain/zero/1.0
100+
101+
[apache-license]: https://www.apache.org/licenses/LICENSE-2.0
102+
103+
<!-- <related-links> -->
104+
105+
<!-- </related-links> -->
106+
107+
</section>
108+
109+
<!-- /.links -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2022 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
25+
var pkg = require( './../package.json' ).name;
26+
var database = require( './../lib' );
27+
28+
29+
// MAIN //
30+
31+
bench( pkg, function benchmark( b ) {
32+
var data;
33+
var i;
34+
b.tic();
35+
for ( i = 0; i < b.iterations; i++ ) {
36+
data = database();
37+
if ( !isPlainObject( data ) ) {
38+
b.fail( 'should return an object' );
39+
}
40+
}
41+
b.toc();
42+
if ( !isPlainObject( data ) ) {
43+
b.fail( 'should return an object' );
44+
}
45+
b.pass( 'benchmark finished' );
46+
b.end();
47+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
"10",`x` min must be strictly less than max
2+
"11",`y` min must be strictly less than max
3+
"12",Kernel is not a function from getKernel
4+
"13",First argument must be a numeric array
5+
"14",Second argument must be a numeric array
6+
"15",First and second argument must be of same length
7+
"16",invalid arguments. Arguments `x` and `y` must have the same length.
8+
"17",invalid arguments. Arguments `x` and `factor` must be arrays of the same length.
9+
"18",invalid option. `alpha` must be a number in [0,1].
10+
"19",invalid arguments. Must provide a length, typed array, array-like object, or an iterable.
11+
"20",invalid argument. The output ndarray must be writable. Cannot write to a read-only ndarray.
12+
"21",invalid arguments. Input and output arrays must have the same number of elements ( i.e., length).
13+
"22",invalid arguments. Input ndarrays must be broadcast compatible.
14+
"23",invalid arguments. Input arrays must have the same number of elements (i.e., length).
15+
"24",insufficient input arguments. Must provide both a target object and one or more source objects.
16+
"25",invalid argument. The list does not contain the provided list node.
17+
"26",not implemented. Please post an issue on the @stdlib/stdlib issue tracker if you would like this to be implemented.
18+
"27",invalid arguments. Input and output arrays must have the same length.
19+
"28",invalid argument. Second argument must have a length equal to the size of the outermost input array dimension.
20+
"29",evaluation error. Did not receive timing results.
21+
"00",insufficient input arguments. Must provide two or more iterators.
22+
"01",insufficient input arguments. Must provide a hash function.
23+
"02",invalid argument. Iterator arguments must be iterator protocol-compliant objects.
24+
"03",insufficient input arguments. Must provide both an iterator and a static value.
25+
"04",insufficient input arguments. Must provide at least one iterator function.
26+
"05",invalid invocation. `this` is not a fluent interface iterator.
27+
"06",invalid operation. A browser environment has no support for changing the current working directory.
28+
"07",invalid operation. The environment does not support reading from `stdin`.
29+
"08",invalid option. `prng` option must have a `MIN` property specifying the minimum possible pseudorandom integer value.
30+
"09",invalid option. `prng` option must have a `MAX` property specifying the maximum possible pseudorandom integer value.
31+
"0A",unexpected error. PRNG returned `NaN`.
32+
"0B",not implemented
33+
"0C",insufficient input arguments. Must provide a search value.
34+
"0D",invalid argument. Must provide a username or, to get who an authenticated user is following, an access token.
35+
"0E",invalid argument. Must provide a username or, to get a list of repositories an authenticated user has starred, an access token.
36+
"0F",invalid argument. Must provide a username or, to get a list of repositories an authenticated user is watching, an access token.
37+
"0G",unexpected error. Unable to resolve package directory as unable to find a `package.json` in a parent directory.
38+
"0H",unexpected error. Unable to resolve root project directory.
39+
"0I",invalid argument. Source code does not contain JSDoc comment with function options.
40+
"0J",insufficient input arguments. Must provide at least one array.
41+
"0K",insufficient input arguments. Must provide multiple functions to compose.
42+
"0L",invalid arguments. First and last arguments must be the same length.
43+
"0M",insufficient input arguments. Must provide multiple functions to execute sequentially.
44+
"0N",insufficient input arguments. Must provide at least two objects.
45+
"0O",insufficient input arguments. Must provide either an array of code points or one or more code points as separate arguments.
46+
"0P",invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.
47+
"0Q",unexpected error. Unable to resolve global object.
48+
"0R",invalid argument. Must provide a zipped array.
49+
"0S",invalid argument. Array must only contain arrays.
50+
"0T",invalid argument. Indices must be specified as an array.
51+
"0U",invalid argument. All indices must be integers.
52+
"0V",invalid argument. Must provide valid indices; i.e., an index must be on the interval [0,len], where len is the tuple length.
53+
"0W",invalid invocation. Constructor must be called with the `new` keyword.
54+
"0X",invalid option. `mode` option cannot be an empty array.
55+
"0Y",invalid argument. Input array must have length `2`.
56+
"0Z",invalid arguments. Unable to resolve a strided array function supporting the provided array argument data types.
57+
"0a",invalid argument. Input array offset argument must be a nonnegative integer.
58+
"0b",invalid argument. Output array offset argument must be a nonnegative integer.
59+
"0c",invalid argument. First input array offset argument must be a nonnegative integer.
60+
"0d",invalid argument. Second input array offset argument must be a nonnegative integer.
61+
"0e",invalid arguments. Interface must accept at least one strided input and/or output array. Based on the provided arguments, `nin+nout` equals `0`.
62+
"0f",invalid argument. Unexpected number of types. A type must be specified for each strided input and output array for each provided strided array function.
63+
"0g",invalid argument. The third argument must have the same number of elements as the first argument.
64+
"0h",invalid argument. Fourth argument is incompatible with the number of strided input and output arrays.
65+
"0i",invalid invocation. Insufficient arguments.
66+
"0j",invalid invocation. Too many arguments.
67+
"0k",invalid argument. First argument must be an integer.
68+
"0l",invalid argument. Input array stride argument must be an integer.
69+
"0m",invalid argument. Output array stride argument must be an integer.
70+
"0n",invalid argument. Input array argument must be an array-like object.
71+
"0o",invalid argument. Output array argument must be an array-like object.
72+
"0p",invalid argument. Input array argument has insufficient elements based on the associated stride and the number of indexed elements.
73+
"0q",invalid argument. Output array argument has insufficient elements based on the associated stride and the number of indexed elements.
74+
"0r",invalid arguments. Subpopulation size `K` must be smaller than or equal to `N`.
75+
"0s",invalid arguments. Number of draws `n` must be smaller than or equal to `N`.
76+
"0t",invalid argument. First argument must contain at least one element greater than zero (i.e., the total number number of observations must be greater than zero).
77+
"0u",invalid arguments. First and second arguments must have the same length.
78+
"0v",invalid arguments. First argument and `opts.groups` must be arrays of the same length.
79+
"0w",invalid arguments. Arguments `x` and `y` must be arrays of the same length
80+
"0x",not enough observations. `x` and `y` must contain at least four observations.
81+
"0y",invalid arguments. The first and second arguments must have the same length.
82+
"0z",`x` or `x - y` cannot be zero for all elements.
83+
"1A",invalid arguments. Creating a generic array from an ArrayBuffer is not supported.
84+
"1B",invalid argument. Must provide a length, typed array, array-like object, or an iterable.
85+
"1C",invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable.
86+
"1D",invalid invocation. `this` context must be a constructor.
87+
"1E",invalid invocation. `this` is not a complex number array.
88+
"1F",invalid argument. First argument must be an array-like object or an iterable.
89+
"1G",invalid arguments. Target array lacks sufficient storage to accommodate source values.
90+
"1H",The current environment does not support SharedArrayBuffers, and, unfortunately, SharedArrayBuffers cannot be polyfilled. For shared memory applications, upgrade your runtime environment to one which supports SharedArrayBuffers.
91+
"1I",invalid argument. Length must a positive integer.
92+
"1J",invalid option. `round` option must be a string.
93+
"1K",invalid arguments. Generated array exceeds maximum array length.
94+
"1L",invalid arguments. If either of the first two arguments are complex numbers, the output array must be a complex number array or a "generic" array-like object.
95+
"1M",invalid arguments. If either of the first two arguments are complex numbers, the output array data type must be a complex number data type or "generic".
96+
"1N",invalid invocation. Insufficient arguments. Must provide a REPL instance.
97+
"1O",invalid operation. No presentation to reload. Use the `load()` method to load a presentation.
98+
"1P",invalid operation. No presentation file to watch. Use the `load()` method to load a presentation.
99+
"1Q",unexpected error. Encountered a "rename" event for the source presentation file. No longer watching source presentation file for changes.
100+
"1R",invalid invocation. Must provide either a string containing presentation text or an options object specifying a presentation file to load.
101+
"1S",invalid argument. When not provided presentation text, an options argument must specify a presentation file to load.
102+
"1T",invalid invocation. Not currently in a presentation workspace. Must provide either a string or nonnegative integer which corresponds to the identifier of the presentation to be stopped.
103+
"1U",invalid operation. Cannot delete the `base` workspace.
104+
"1V",invalid argument. Must provide a program AST node.
105+
"1W",command execution terminated.
106+
"1X",invalid operation. Cannot load a file into a REPL which has already closed.
107+
"1Y",invalid operation. Cannot reset a REPL which has already closed.
108+
"1Z",invalid operation. Cannot clear a REPL which has already closed.
109+
"1a",invalid operation. Cannot clear the line of a REPL which has already closed.
110+
"1b",invalid operation. Cannot clear the command buffer of a REPL which has already closed.
111+
"1c",invalid argument. Provided command either does not contain an `await` expression or contains a top-level `return` which is not allowed.
112+
"1d",invalid argument. Cannot broadcast an array to a shape having fewer dimensions. Arrays can only be broadcasted to shapes having the same or more dimensions.
113+
"1e",invalid argument. Must provide an ndarray having two or more dimensions.
114+
"1f",invalid arguments. Arrays must have the same shape.
115+
"1g",invalid argument. First argument must contain at least one element.
116+
"1h",invalid arguments. The length of the first argument is incompatible with the second and third arguments.
117+
"1i",invalid invocation. Cannot write to a read-only array.
118+
"1j",invalid argument. `strides` length must be equal to 1 when creating a zero-dimensional ndarray.
119+
"1k",invalid arguments. The input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.
120+
"1l",invalid arguments. Must provide either a data source, array shape, or both.
121+
"1m",invalid arguments. Array shape is incompatible with provided data source. Number of data source elements does not match array shape.
122+
"1n",invalid arguments. Interface must accept at least one input and/or output ndarray. Based on the provided arguments, `nin+nout` equals `0`.
123+
"1o",invalid arguments. Fourth argument does not equal the number of input and output ndarrays.
124+
"1p",invalid argument. Unexpected number of types. A type must be specified for each input and output ndarray for each provided ndarray function.
125+
"1q",invalid argument. Input array argument must be an ndarray-like object.
126+
"1r",invalid argument. Output array argument must be an ndarray-like object.
127+
"1s",invalid arguments. Unable to resolve an ndarray function supporting the provided array argument data types.
128+
"1t",invalid argument. Third argument must not be an empty string.
129+
"1u",invalid argument. Output string length exceeds maximum allowed string length.
130+
"1v",invalid argument. Pad string must not be an empty string.
131+
"1w",invalid operation. Unable to load Electron. Ensure Electron is installed and try again.
132+
"1x",method not implemented.
133+
"1y",max retries exceeded. Too many open files.
134+
"1z",invalid arguments. Strided array parameters are incompatible with the provided array-like object. Linear index exceeds array bounds.
135+
"2A",evaluation error. Unable to retrieve evaluation results. Ensure that the provided snippet does not return prematurely.
136+
"2B",invalid invocation. `this` is not host tuple.
137+
"2C",invalid invocation. `this` is not the host tuple factory.
138+
"2D",invalid invocation. `this` is not a compact adjacency matrix.
139+
"2E",invalid argument. Providing a number is not supported.
140+
"2F",invalid argument. Providing a complex number is not supported.
141+
"2G",invalid argument. Providing an ndarray is not supported.
142+
"2H",invalid argument. Providing an array-like object is not supported.
143+
"2I",invalid argument. If the first argument is an ndarray, the second argument must be an ndarray.
144+
"2J",invalid argument. Output array must have the same number of elements (i.e., length) as the input array.
145+
"2K",invalid argument. If the first argument is an array-like object, the second argument must be an array-like object.
146+
"2L",invalid argument. Providing a number is not supported. Consider providing a zero-dimensional ndarray containing the numeric value.
147+
"2M",invalid argument. Providing a complex number is not supported. Consider providing a zero-dimensional ndarray containing the complex number value.
148+
"2N",TODO: remove me
149+
"2O",benchmark failed
150+
"2P",invalid benchmark
151+
"2Q",exception
152+
"2R",invalid argument. Attempted to add duplicate listener.
153+
"2S",invalid argument. Options must be an object. Value: `%s`.
154+
"2T",invalid option. `%s` option must be a primitive string. Option: `%s`.
155+
"2U",invalid option. `%s` option must be a primitive boolean. Option: `%s`.
156+
"2V",invalid option. `%s` option must be a primitive string or null. Option: `%s`.
157+
"2W",invalid option. `%s` option must be a nonnegative number. Option: `%s`.
158+
"2X",invalid option. `%s` option must be a nonnegative integer. Option: `%s`.
159+
"2Y",invalid option. `%s` option must be a positive integer. Option: `%s`.

0 commit comments

Comments
 (0)