码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-10-06 22:11:38      阅读:194      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!