forked from EVOgeek/Vmeda.Online
		
	MOBILE-4109 core: Log unhandled errors
This commit is contained in:
		
							parent
							
								
									cd8f81d332
								
							
						
					
					
						commit
						56c4877b2e
					
				| @ -449,7 +449,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncCompo | |||||||
|      * @param site Site instance. |      * @param site Site instance. | ||||||
|      * @return Promise resolved when done. |      * @return Promise resolved when done. | ||||||
|      */ |      */ | ||||||
|     protected async treatHTMLElements(div: HTMLElement, site?: CoreSite): Promise<void> { |     protected treatHTMLElements(div: HTMLElement, site?: CoreSite): void { | ||||||
|         const images = Array.from(div.querySelectorAll('img')); |         const images = Array.from(div.querySelectorAll('img')); | ||||||
|         const anchors = Array.from(div.querySelectorAll('a')); |         const anchors = Array.from(div.querySelectorAll('a')); | ||||||
|         const audios = Array.from(div.querySelectorAll('audio')); |         const audios = Array.from(div.querySelectorAll('audio')); | ||||||
| @ -560,7 +560,8 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncCompo | |||||||
|             promises.push(CoreUtils.ignoreErrors(CoreUtils.timeoutPromise(promise, 5000))); |             promises.push(CoreUtils.ignoreErrors(CoreUtils.timeoutPromise(promise, 5000))); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         await Promise.all(promises); |         // Run asynchronous operations in the background to avoid blocking rendering.
 | ||||||
|  |         Promise.all(promises).catch(error => CoreUtils.logUnhandledError('Error treating format-text elements', error)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -139,6 +139,16 @@ export class CoreUtilsProvider { | |||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Log an unhandled error. | ||||||
|  |      * | ||||||
|  |      * @param message Message to contextualize the error. | ||||||
|  |      * @param error Error to log. | ||||||
|  |      */ | ||||||
|  |     logUnhandledError(message: string, error: unknown): void { | ||||||
|  |         this.logger.error(message, error); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Converts an array of objects to an indexed array, using a property of each entry as the key. |      * Converts an array of objects to an indexed array, using a property of each entry as the key. | ||||||
|      * Every entry will contain an array of the found objects of the property identifier. |      * Every entry will contain an array of the found objects of the property identifier. | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user