mirror of
				https://codeberg.org/buzzcode2007/FCC-Project-URLShortener.git
				synced 2025-05-21 03:06:34 +00:00 
			
		
		
		
	import modules errors.js and messaging.js
from https://codeberg.org/buzzcode2007/fcc-project-timestamp/src/branch/master/scripts/messaging.js
This commit is contained in:
		
							parent
							
								
									19f55bfaa2
								
							
						
					
					
						commit
						57d21ccf41
					
				
					 2 changed files with 26 additions and 0 deletions
				
			
		
							
								
								
									
										10
									
								
								scripts/utilities/errors.js
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								scripts/utilities/errors.js
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,10 @@ | ||||||
|  | class CustomErrors {} | ||||||
|  | 
 | ||||||
|  | CustomErrors.URL = class URL_Error extends Error { | ||||||
|  |     constructor(message) { | ||||||
|  |         super(message); | ||||||
|  |         this.name = "URL Problem"; | ||||||
|  |     }; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | module.exports = {CustomErrors} | ||||||
							
								
								
									
										16
									
								
								scripts/utilities/messaging.js
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										16
									
								
								scripts/utilities/messaging.js
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | class Messaging { | ||||||
|  |     /*  | ||||||
|  |     Return an error message.  | ||||||
|  | 
 | ||||||
|  |     @param {object} INSTANCE - The response instance | ||||||
|  |     @param {object} ERROR - The error object | ||||||
|  |     */ | ||||||
|  |     static exception (INSTANCE, ERROR) { | ||||||
|  |         let MESSAGE = {error: ERROR}; | ||||||
|  |         INSTANCE.json(MESSAGE); | ||||||
|  |         console.error(ERROR); | ||||||
|  |         return (MESSAGE); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | module.exports = {Messaging} | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue