-
Notifications
You must be signed in to change notification settings - Fork 0
/
communication.js
40 lines (34 loc) · 1.19 KB
/
communication.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
'use strict';
const DEFAULT_MESSAGES = require('./constants/defaultMessages');
const HTTP_STATUS_CODES = require('./constants/httpStatusCodes');
const { SERVER_ERROR } = require('./server');
class FIREBASE_ERROR extends SERVER_ERROR {
constructor(message = DEFAULT_MESSAGES.SERVER_ERROR, ...args) {
super(HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR, message, ...args);
Error.captureStackTrace(this, FIREBASE_ERROR);
}
}
class SENDGRID_ERROR extends SERVER_ERROR {
constructor(message = DEFAULT_MESSAGES.SERVER_ERROR, ...args) {
super(HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR, message, ...args);
Error.captureStackTrace(this, SENDGRID_ERROR);
}
}
class SES_ERROR extends SERVER_ERROR {
constructor(message = DEFAULT_MESSAGES.SERVER_ERROR, ...args) {
super(HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR, message, ...args);
Error.captureStackTrace(this, SES_ERROR);
}
}
class TWILIO_ERROR extends SERVER_ERROR {
constructor(message = DEFAULT_MESSAGES.SERVER_ERROR, ...args) {
super(HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR, message, ...args);
Error.captureStackTrace(this, TWILIO_ERROR);
}
}
module.exports = {
FIREBASE_ERROR,
SENDGRID_ERROR,
SES_ERROR,
TWILIO_ERROR
};