Add error handling for get-timeline
				
					
				
			This commit is contained in:
		@@ -60,7 +60,11 @@ export default class Column extends Vue {
 | 
			
		||||
 | 
			
		||||
  created() {
 | 
			
		||||
    // timelineのnameとtypeをthis.idから取得する
 | 
			
		||||
    let doc: TimelineDoc = ipcRenderer.sendSync('get-timeline', this.id)
 | 
			
		||||
    let doc: TimelineDoc | null = ipcRenderer.sendSync('get-timeline', this.id)
 | 
			
		||||
    if (doc === null) {
 | 
			
		||||
      this.$destroy()
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    this.name = doc.name
 | 
			
		||||
    this.type = doc.type
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,13 @@ export default class Timeline {
 | 
			
		||||
 | 
			
		||||
    public static ready() {
 | 
			
		||||
        ipcMain.on('add-timeline', (event: Event, name: string, type: string) => this.onAddTimeline(event, name, type))
 | 
			
		||||
        ipcMain.on('get-timeline', async (event: Event, id: string) => event.returnValue = await this.getTimeline(id))
 | 
			
		||||
        ipcMain.on('get-timeline', async (event: Event, id: string) => {
 | 
			
		||||
            try {
 | 
			
		||||
                event.returnValue = await this.getTimeline(id)
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                event.returnValue = null
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        ipcMain.on('no-auth-timeline', (event: Event, name: string) => this.onNoAuthTimeline(event, name))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user