-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.js
More file actions
36 lines (33 loc) · 862 Bytes
/
error.js
File metadata and controls
36 lines (33 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class HttpEror extends Error {
constructor (mes) {
super(mes)
this.name = 'HttpError'
}
}
class DbError extends Error {
constructor (message, cause) {
super(message)
this.cause = cause
this.name = 'DBError'
}
}
class ReadError extends Error {
constructor (message, cause) {
super(message)
this.cause = cause
this.name = 'ReadError'
}
}
class ValidationError extends ReadError {}
class PropertyRequiredError extends ValidationError {
constructor (property) {
super('Отсутствует свойство : ' + property)
this.property = property
this.name = this.constructor.name
}
}
module.exports.HttpEror = HttpEror
module.exports.DbError = DbError
module.exports.ReadError = ReadError
module.exports.ValidationError = ValidationError
module.exports.PropertyRequiredError = PropertyRequiredError