pustovitDmytro /
cottus
| 1 | /* eslint-disable no-param-reassign */ |
||
| 2 | /* eslint-disable import/no-commonjs */ |
||
| 3 | /* eslint-disable import/unambiguous */ |
||
| 4 | const errors = require('../lib/errors'); |
||
| 5 | |||
| 6 | const Errors = Object.values(errors); |
||
| 7 | |||
| 8 | module.exports = { |
||
| 9 | onSection(section) { |
||
| 10 | const values = section.values[0]; |
||
| 11 | const errorClassName = values.name; |
||
| 12 | const Error = Errors.find(e => e.name === errorClassName); |
||
|
0 ignored issues
–
show
Comprehensibility
introduced
by
Loading history...
|
|||
| 13 | |||
| 14 | if (Error) { |
||
| 15 | const e = new Error(); |
||
| 16 | |||
| 17 | values.id = e.code; |
||
| 18 | values.description = e.message; |
||
| 19 | } |
||
| 20 | } |
||
| 21 | }; |
||
| 22 |