首页 > 其他 > 详细

[Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Exception Handling in groovy

时间:2015-10-06 22:09:37      阅读:212      评论:0      收藏:0      [点我收藏+]
def x = new String[3]

x[0] = "A"
x[1] = "B"
x[2] = "C"

log.info"XXXXXX 1"
try{
	x[3] = "D"
//	def z=9/0
}catch(Exception e){
	log.info "Some error "+e.getMessage()   // Use e.getMessage() to print exception information
//	e.printStackTrace()       // This one is used to print the process of invoking functions
}
log.info"XXXXXX 2"

 Result:

Tue Oct 06 21:47:38 CST 2015:INFO:XXXXXX 1
Tue Oct 06 21:47:38 CST 2015:INFO:Some error 3
Tue Oct 06 21:47:38 CST 2015:INFO:XXXXXX 2

 

[Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Exception Handling in groovy

原文:http://www.cnblogs.com/MasterMonkInTemple/p/4857830.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!