Unpackage an error object
This commit is contained in:
		
							parent
							
								
									d586ef8115
								
							
						
					
					
						commit
						1f7661ff12
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		|  | @ -71,6 +71,13 @@ export default class logging { | ||||||
| 	@param {boolean} critical the critical nature | 	@param {boolean} critical the critical nature | ||||||
| 	*/ | 	*/ | ||||||
| 	static async error(ERROR_CODE, ERROR_MESSAGE, ERROR_STACK, critical = true) { | 	static async error(ERROR_CODE, ERROR_MESSAGE, ERROR_STACK, critical = true) { | ||||||
|  | 		// Depackage the shortcut method of sending the error message. 
 | ||||||
|  | 		(!ERROR_MESSAGE && !ERROR_STACK && (typeof ERROR_CODE).includes(`obj`)) ? ( | ||||||
|  | 			ERROR_MESSAGE = ERROR_CODE.message, | ||||||
|  | 			ERROR_STACK = ERROR_CODE.stack, | ||||||
|  | 			ERROR_CODE = ERROR_CODE.name | ||||||
|  | 		) : false; | ||||||
|  | 
 | ||||||
| 		// Display the error message.
 | 		// Display the error message.
 | ||||||
| 		console.error('%c%s%c%s%c%s%c\n%s%c', `font-weight: bold;`, ERROR_CODE, ``, `: `, ``, ERROR_MESSAGE, `font-family: monospace;`, ERROR_STACK, ``); | 		console.error('%c%s%c%s%c%s%c\n%s%c', `font-weight: bold;`, ERROR_CODE, ``, `: `, ``, ERROR_MESSAGE, `font-family: monospace;`, ERROR_STACK, ``); | ||||||
| 		 | 		 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue