Blame view

utils/send-response.js 923 Bytes
33ead877   Nattapon Wongpaet   first code
1
2
3
4
5
6
7
8
9
10
11
12
13

let sendResponse = {};

sendResponse.missingOrInvalidResponse = (param) => {
    let response = {
        resultCode: 40300,
        resultDescription: 'Missing or invalid parameter',
        diagnosticMessage: param
    }
    return response;
};


0b6272e0   sumatek   update template
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// sendResponse.handleError = function(error) {
//     console.log('catch ' + error);
//     let errResponse = {};
//     if (error instanceof ValidationError) {
//         errResponse = {
//             code: 403,
//             object: this.missingOrInvalidResponse(error.instance[0].message)
//         };
//     } else if (error instanceof UnirestError) {
//         errResponse = {
//             code: 500,
//             object: error.instance
//         };
//     } else {
//         errResponse = {
//             code: 500,
//             object: { message: "System Error" }
//         };
//     }
//     return errResponse;
// };
33ead877   Nattapon Wongpaet   first code
35
36

module.exports = sendResponse;