-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhub.js
43 lines (38 loc) · 1010 Bytes
/
hub.js
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
37
38
39
40
41
42
43
'use strict';
const events = require('./events.js');
const forwarder = require('./forwarder/forwarder');
/**
* Class ErrorHub
*
*/
class ErrorHub {
/**
* logError - SlipUp method
* @param {*} e - OBJECT: Takes standard error object.
* @param {*} userid - STRING: Takes a string value to identify programmer.
* @param {*} userparam - VARIABLE: Designed to receive parameter from parent function. It identifies which parameter caused the error.
* @param {*} usernote - STRING: Takes a custom user defined string.
*/
logError(e, userid = null, userparam = null, usernote = null) {
let payload = {
err: e,
userid: userid,
userparam: userparam,
usernote: usernote,
};
events.emit('errEvent', payload);
}
/**
* logError1
* @param {*} e - Error object
* @param {*} obj - Meta data option
*/
logError1(e, obj={}) {
let payload = {
err: e,
metadata: obj
};
events.emit('errEvent', payload);
}
}
module.exports = new ErrorHub();