チェンジセット 146

差分発生行の前後
無視リスト:
コミット日時:
2007/12/12 23:28:34 (1 年前)
コミッタ:
yossy
ログメッセージ:

例外の処理方法の変更

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as2/Thread/src/org/libspark/thread/Thread.as

    r145 r146  
    215215        private function internalExecute():Void 
    216216        { 
     217                var children:Array = _children; 
     218                var l:Number = children.length; 
     219                for (var i:Number = 0; i < l; ++i) { 
     220                        try { 
     221                                Thread(children[i]).internalExecute(); 
     222                        } 
     223                        catch (e:Error) { 
     224                                handleError(e); 
     225                        } 
     226                } 
     227                 
    217228                try { 
    218                         var children:Array = _children; 
    219                         var l:Number = children.length; 
    220                         for (var i:Number = 0; i < l; ++i) { 
    221                                 Thread(children[i]).internalExecute(); 
    222                         } 
    223                          
    224229                        _currentThread = this; 
    225230                        _executeHandler.apply(this); 
    226231                } 
    227                 catch (e:Error) { 
    228                         try { 
    229                                catchError(_currentThread, e); 
    230                        } 
    231                         catch (ee:Error) { 
    232                                if (_errorHandler != null) { 
    233                                        try { 
    234                                                _errorHandler.handleError(_currentThread, ee); 
    235                                                return; 
    236                                        } 
    237                                        catch (eee:Error)
    238                                                ee = eee
    239                                        
    240                                } 
    241                                 
     232                catch (e2:Error) { 
     233                        handleError(e2); 
     234                } 
     235                finally { 
     236                        _currentThread = null; 
     237                } 
     238        } 
     239         
     240        private function handleError(e:Error):Void 
     241        { 
     242                try
     243                        catchError(_currentThread, e)
     244               
     245                catch (ee:Error) { 
     246                        if ((ee = handleByErrorHandler(ee)) != null) { 
    242247                                terminateHandler(); 
    243248                                _state |= STATE_ERROR; 
     
    246251                        } 
    247252                } 
    248                 finally { 
    249                         _currentThread = null; 
    250                 } 
     253        } 
     254         
     255        private function handleByErrorHandler(e:Error):Error 
     256        { 
     257                        if (_errorHandler != null) { 
     258                                try { 
     259                                        _errorHandler.handleError(_currentThread, e); 
     260                                        e = null; 
     261                                } 
     262                                catch (ee:Error) { 
     263                                        e = ee; 
     264                                } 
     265                        } 
     266                        return e; 
    251267        } 
    252268         
  • as3/Thread/src/org/libspark/thread/Thread.as

    r145 r146  
    214214                internal function internalExecute():void 
    215215                { 
     216                        var children:Array = _children; 
     217                        var l:uint = children.length; 
     218                        for (var i:uint = 0; i < l; ++i) { 
     219                                try { 
     220                                        Thread(children[i]).internalExecute(); 
     221                                } 
     222                                catch (e:Error) { 
     223                                        handleError(e); 
     224                                } 
     225                        } 
     226                         
    216227                        try { 
    217                                 var children:Array = _children; 
    218                                 var l:uint = children.length; 
    219                                 for (var i:uint = 0; i < l; ++i) { 
    220                                         Thread(children[i]).internalExecute(); 
    221                                 } 
    222                                  
    223228                                _currentThread = this; 
    224229                                _executeHandler.apply(this); 
    225230                        } 
    226                         catch (e:Error) { 
    227                                 try { 
    228                                         catchError(_currentThread, e); 
    229                                 } 
    230                                 catch (ee:Error) { 
    231                                         if ((ee = handleByErrorHandler(ee)) != null) { 
    232                                                 terminateHandler(); 
    233                                                 _state |= STATE_ERROR; 
    234                                                  
    235                                                 throw ee; 
    236                                         } 
    237                                 } 
     231                        catch (e2:Error) { 
     232                                handleError(e2); 
    238233                        } 
    239234                        finally { 
    240235                                _currentThread = null; 
     236                        } 
     237                } 
     238                 
     239                private function handleError(e:Error):void 
     240                { 
     241                        try { 
     242                                catchError(_currentThread, e); 
     243                        } 
     244                        catch (ee:Error) { 
     245                                if ((ee = handleByErrorHandler(ee)) != null) { 
     246                                        terminateHandler(); 
     247                                        _state |= STATE_ERROR; 
     248                                         
     249                                        throw ee; 
     250                                } 
    241251                        } 
    242252                }