-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.js
More file actions
21 lines (17 loc) · 800 Bytes
/
errors.js
File metadata and controls
21 lines (17 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const errors = [
// Base model
{ code: 1001, message: 'Wrong or undefined apiPath' },
{ code: 1002, message: 'Exception caught in model Base::findById()' },
{ code: 1003, message: 'Exception caught in model Base::search()' },
{ code: 1004, message: 'Exception caught in model Base::save()' },
// Goal model
{ code: 1102, message: 'Exception caught in model Goal::findById()' },
{ code: 1103, message: 'Exception caught in model Goal::findByUser()' },
// Contract model
{ code: 1202, message: 'Exception caught in model Contract::findById()' },
{ code: 1203, message: 'Exception caught in model Contract::findByUser()' }
]
module.exports.getByCode = (code) => {
const ret = errors.filter(err => err.code === code)
return ret[0] || null
}