hacktoberfestdockerselfhostedself-hostedresponsivemonitoringwebsocketwebappuptime-monitoringuptimesocket-iosingle-page-app
		
		
		
		
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							36 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							36 lines
						
					
					
						
							1.0 KiB
						
					
					
				| class NotificationProvider { | |
| 
 | |
|     /** | |
|      * Notification Provider Name | |
|      * @type string | |
|      */ | |
|     name = undefined; | |
| 
 | |
|     /** | |
|      * @param notification : BeanModel | |
|      * @param msg : string General Message | |
|      * @param monitorJSON : object Monitor details (For Up/Down only) | |
|      * @param heartbeatJSON : object Heartbeat details (For Up/Down only) | |
|      * @returns {Promise<string>} Return Successful Message | |
|      * Throw Error with fail msg | |
|      */ | |
|     async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { | |
|         throw new Error("Have to override Notification.send(...)"); | |
|     } | |
| 
 | |
|     throwGeneralAxiosError(error) { | |
|         let msg = "Error: " + error + " "; | |
| 
 | |
|         if (error.response && error.response.data) { | |
|             if (typeof error.response.data === "string") { | |
|                 msg += error.response.data; | |
|             } else { | |
|                 msg += JSON.stringify(error.response.data) | |
|             } | |
|         } | |
| 
 | |
|         throw new Error(msg) | |
|     } | |
| } | |
| 
 | |
| module.exports = NotificationProvider;
 | |
| 
 |