在下面的代码中
begin raise StandardError,'message' #some code that raises a lot of exception rescue StandardError #handle error rescue OtherError #handle error rescue YetAnotherError #handle error end
我想打印一个警告,指出错误的类型和消息,而不会向每个救援条款添加print语句,例如@H_403_5@
begin raise StandardError,'message' #some code that raises a lot of exception rescue StandardError #handle error rescue OtherError #handle error rescue YetAnotherError #handle error ??? print "An error of type #{???} happened,message is #{???}" end