add error display
This commit is contained in:
		
							parent
							
								
									c784faecf3
								
							
						
					
					
						commit
						71e3ec69f7
					
				
					 1 changed files with 25 additions and 0 deletions
				
			
		
							
								
								
									
										25
									
								
								gui/scripts/logging.JS
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								gui/scripts/logging.JS
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| /* | ||||
| logging.JS | ||||
| Send messages for logging. | ||||
| */ | ||||
| 
 | ||||
| export default class logging { | ||||
|   /* | ||||
|   Raise an error message. | ||||
| 
 | ||||
|   @param {number} ERROR_CODE the error code | ||||
|   @param {number} ERROR_MESSAGE the custom error message | ||||
|   */ | ||||
|   static error(ERROR_CODE, ERROR_MESSAGE, critical = true) { | ||||
|     (async () => { | ||||
|       // Import the templating.
 | ||||
|       const texts = await import(chrome.runtime.getURL("gui/scripts/read.JS")); | ||||
| 
 | ||||
|       // Display the error message.
 | ||||
|       console.error(texts.read(`error_msg`, [ERROR_CODE, ERROR_MESSAGE])); | ||||
|       if (critical) { | ||||
|         alert(texts.read(`error_msg_GUI`, [String(ERROR_CODE)])) | ||||
|       }; | ||||
|     })(); | ||||
|   } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue