mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	client: Improve logging for basic sync crash
This commit is contained in:
		
							parent
							
								
									48b0af1bba
								
							
						
					
					
						commit
						81ca0a3776
					
				| @ -75,6 +75,7 @@ async function getWidgetBundlesByParent() { | |||||||
| 
 | 
 | ||||||
|         try { |         try { | ||||||
|             widget = await executeBundle(bundle); |             widget = await executeBundle(bundle); | ||||||
|  |             widget._noteId = bundle.noteId; | ||||||
|             widgetsByParent.add(widget); |             widgetsByParent.add(widget); | ||||||
|         } |         } | ||||||
|         catch (e) { |         catch (e) { | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| import Component from "../components/component.js"; | import Component from "../components/component.js"; | ||||||
|  | import froca from "../services/froca.js"; | ||||||
| import { t } from "../services/i18n.js"; | import { t } from "../services/i18n.js"; | ||||||
| import toastService from "../services/toast.js"; | import toastService from "../services/toast.js"; | ||||||
| 
 | 
 | ||||||
| @ -85,11 +86,29 @@ class BasicWidget extends Component { | |||||||
|         try { |         try { | ||||||
|             this.doRender(); |             this.doRender(); | ||||||
|         } catch (e) { |         } catch (e) { | ||||||
|  |             console.log("Got issue in widget ", this); | ||||||
|  |             console.error(e); | ||||||
|  |              | ||||||
|  |             let noteId = this._noteId; | ||||||
|  |             if (this._noteId) { | ||||||
|  |                 froca.getNote(noteId, true).then((note) => { | ||||||
|                     toastService.showPersistent({ |                     toastService.showPersistent({ | ||||||
|                         title: t("toast.widget-error.title"), |                         title: t("toast.widget-error.title"), | ||||||
|                         icon: "alert", |                         icon: "alert", | ||||||
|                 message: t("toast.widget-error.message", { |                         message: t("toast.widget-error.message-custom", { | ||||||
|                     title: this.widgetTitle, |                             id: noteId, | ||||||
|  |                             title: note.title, | ||||||
|  |                             message: e.message | ||||||
|  |                         }) | ||||||
|  |                     }); | ||||||
|  |                 }); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             toastService.showPersistent({ | ||||||
|  |                 title: t("toast.widget-error.title"), | ||||||
|  |                 icon: "alert", | ||||||
|  |                 message: t("toast.widget-error.message-unknown", { | ||||||
|                     message: e.message |                     message: e.message | ||||||
|                 }) |                 }) | ||||||
|             }); |             }); | ||||||
|  | |||||||
| @ -16,7 +16,8 @@ | |||||||
|     }, |     }, | ||||||
|     "widget-error": { |     "widget-error": { | ||||||
|       "title": "Failed to initialize a widget", |       "title": "Failed to initialize a widget", | ||||||
|       "message": "Widget with title \"{{title}}\" could not be initialized due to:\n\n{{message}}" |       "message-custom": "Custom widget from note with ID \"{{id}}\", titled \"{{title}}\" could not be initialized due to:\n\n{{message}}", | ||||||
|  |       "message-unknown": "Unknown widget could not be initialized due to:\n\n{{message}}" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "add_link": { |   "add_link": { | ||||||
|  | |||||||
| @ -15,8 +15,7 @@ | |||||||
|       "message": "Ha ocurrido un error crítico que previene que el cliente de la aplicación inicie:\n\n{{message}}\n\nMuy probablemente es causado por un script que falla de forma inesperada. Intente iniciar la aplicación en modo seguro y atienda el error." |       "message": "Ha ocurrido un error crítico que previene que el cliente de la aplicación inicie:\n\n{{message}}\n\nMuy probablemente es causado por un script que falla de forma inesperada. Intente iniciar la aplicación en modo seguro y atienda el error." | ||||||
|     }, |     }, | ||||||
|     "widget-error": { |     "widget-error": { | ||||||
|       "title": "No se pudo inicializar un widget", |       "title": "No se pudo inicializar un widget" | ||||||
|       "message": "Widget con título \"{{title}}\" no pudo ser inicializado debido a:\n\n{{message}}" |  | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "add_link": { |   "add_link": { | ||||||
|  | |||||||
| @ -15,8 +15,7 @@ | |||||||
|       "message": "Une erreur critique s'est produite qui empêche l'application client de démarrer :\n\n{{message}}\n\nCeci est probablement dû à un échec inattendu d'un script. Essayez de démarrer l'application en mode sans échec et de résoudre le problème." |       "message": "Une erreur critique s'est produite qui empêche l'application client de démarrer :\n\n{{message}}\n\nCeci est probablement dû à un échec inattendu d'un script. Essayez de démarrer l'application en mode sans échec et de résoudre le problème." | ||||||
|     }, |     }, | ||||||
|     "widget-error": { |     "widget-error": { | ||||||
|       "title": "Impossible d'initialiser un widget", |       "title": "Impossible d'initialiser un widget" | ||||||
|       "message": "Le widget portant le titre \"{{title}}\" n'a pas pu être initialisé en raison de :\n\n{{message}}" |  | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "add_link": { |   "add_link": { | ||||||
|  | |||||||
| @ -1190,7 +1190,8 @@ | |||||||
|     }, |     }, | ||||||
|     "widget-error": { |     "widget-error": { | ||||||
|       "message": "Widget-ul intitulat „{{title}}” nu a putut fi inițializat din cauza:\n\n{{message}}", |       "message": "Widget-ul intitulat „{{title}}” nu a putut fi inițializat din cauza:\n\n{{message}}", | ||||||
|       "title": "Eroare la inițializarea unui widget" |       "title": "Eroare la inițializarea unui widget", | ||||||
|  |       "message-custom": "Widget-ul personalizat din notița cu ID-ul „{{id}}”, întitulată ”{{title}}” nu a putut fi inițializată din cauza:\n\n{{message}}" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "tray": { |   "tray": { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran