Some exception handling changes.
Some exception handling changes.

SheffieldML/GPmat,SheffieldML/GPmat,SheffieldML/GPmat,TianpeiLuke/GPmat,TianpeiLuke/GPmat,TianpeiLuke/GPmat,SheffieldML/GPmat,TianpeiLuke/GPmat,TianpeiLuke/GPmat,SheffieldML/GPmat,SheffieldML/GPmat,TianpeiLuke/GPmat