001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    package graphlab.platform.core.exception;
005    
006    import graphlab.platform.core.BlackBoard;
007    import graphlab.platform.StaticUtils;
008    
009    import java.lang.Thread.UncaughtExceptionHandler;
010    
011    public class ExceptionHandler implements UncaughtExceptionHandler {
012    
013        BlackBoard blackBoard;
014    
015        public ExceptionHandler(BlackBoard bb) {
016            super();
017            blackBoard = bb;
018        }
019    
020        public void uncaughtException(Thread t, Throwable e) {
021            System.err.println("Exception Occured: " + e.toString());
022            e.printStackTrace();
023            StaticUtils.addExceptiontoLog(e, blackBoard);
024        }
025    
026    }