example/index.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 22
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 13
mnd 1
bc 1
fnc 0
dl 0
loc 22
rs 10
bpm 0
cpm 0
noi 1
c 0
b 0
f 0
1
import { TErrorGroup } from '../package/index.js';
2
3
const errorsList = {
4
  PAGE_NOT_FOUND: {
5
    message: 'Page not found :(', //Message for user
6
    name: 'REQUEST_ERROR', //name for logging
7
    code: 404 //HTTP code
8
  }
9
};
10
11
const params = {
12
  type: 'SERVER_ERROR'
13
};
14
15
16
const ServerError = new TErrorGroup(params, errorsList).setLogger(console.error);
17
18
try {
19
  throw ServerError.create('PAGE_NOT_FOUND');
20
} catch(err) {
21
  console.log('Catch error:', err)
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
22
}
23
24