catch y-* related errors
This commit is contained in:
		
							parent
							
								
									f537a43e29
								
							
						
					
					
						commit
						40fb16ef32
					
				@ -67,7 +67,11 @@ export default function Utils (Y) {
 | 
				
			|||||||
      this._eventListener[name] = listener.filter(e => e !== f)
 | 
					      this._eventListener[name] = listener.filter(e => e !== f)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    emit (name, value) {
 | 
					    emit (name, value) {
 | 
				
			||||||
      (this._eventListener[name] || []).forEach(l => l(value))
 | 
					      let listener = this._eventListener[name] || []
 | 
				
			||||||
 | 
					      if (name === 'error' && listener.length === 0) {
 | 
				
			||||||
 | 
					        console.error(value)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      listener.forEach(l => l(value))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    destroy () {
 | 
					    destroy () {
 | 
				
			||||||
      this._eventListener = null
 | 
					      this._eventListener = null
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,3 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
import extendRBTree from './RedBlackTree'
 | 
					import extendRBTree from './RedBlackTree'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function extend (Y) {
 | 
					export default function extend (Y) {
 | 
				
			||||||
@ -48,9 +47,13 @@ export default function extend (Y) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    transact (makeGen) {
 | 
					    transact (makeGen) {
 | 
				
			||||||
      const t = new Transaction(this)
 | 
					      const t = new Transaction(this)
 | 
				
			||||||
      while (makeGen != null) {
 | 
					      try {
 | 
				
			||||||
        makeGen.call(t)
 | 
					        while (makeGen != null) {
 | 
				
			||||||
        makeGen = this.getNextRequest()
 | 
					          makeGen.call(t)
 | 
				
			||||||
 | 
					          makeGen = this.getNextRequest()
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      } catch (e) {
 | 
				
			||||||
 | 
					        this.y.emit('error', e)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    destroy () {
 | 
					    destroy () {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user