catch-match 1.0.1 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +23 -0
- package/package.json +2 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# catch-match
|
2
|
+
![image](https://user-images.githubusercontent.com/1615093/149611056-ad5f8c6c-d7fe-4a64-aed4-a1763135e7ee.png)
|
2
3
|
|
3
4
|
## Motivation
|
4
5
|
|
6
|
+
### java
|
5
7
|
```java
|
6
8
|
try {
|
7
9
|
...
|
@@ -16,6 +18,27 @@ try {
|
|
16
18
|
}
|
17
19
|
```
|
18
20
|
|
21
|
+
### javascript
|
22
|
+
```javascript
|
23
|
+
try {
|
24
|
+
error; // error intruction
|
25
|
+
} catch (err) {
|
26
|
+
switch(err.constructor) {
|
27
|
+
case ReferenceError:
|
28
|
+
case SyntaxError:
|
29
|
+
console.error(`${err.constructor.name}: ${err.message}`);
|
30
|
+
break;
|
31
|
+
default:
|
32
|
+
console.error('other error:', err);
|
33
|
+
}
|
34
|
+
} finally {
|
35
|
+
console.log('final')
|
36
|
+
}
|
37
|
+
|
38
|
+
//> ReferenceError: error is not defined
|
39
|
+
//> final
|
40
|
+
```
|
41
|
+
|
19
42
|
## Getting started
|
20
43
|
|
21
44
|
```shell
|
package/package.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "catch-match",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.5",
|
4
4
|
"repository": {
|
5
5
|
"url": "https://github.com/kobzarvs/catch-match"
|
6
6
|
},
|
7
|
+
"keywords": ["try", "catch", "match", "pattern", "errors", "exceptions", "throw", "finally"],
|
7
8
|
"type": "module",
|
8
9
|
"main": "dist/main.js",
|
9
10
|
"scripts": {
|