17,740
社区成员
发帖
与我相关
我的任务
分享
try
{
......
}
catch (ResponseErrorException customError)
{
logHelper.Write(string.Format("商户查证可疑订单执行:{0},\r\n错误原因:{1}", JsonConvert.SerializeObject(item), customError.Message));
}
catch (ThirdPlatformException customError)
{
logHelper.Write(string.Format("商户查证可疑订单执行:{0},\r\n错误原因:{1}", JsonConvert.SerializeObject(item), customError.Message));
}
catch (Exception ex)
{
logHelper.Write(string.Format("商户查证可疑订单执行:{0},\r\n错误原因:{1}", JsonConvert.SerializeObject(item), ex.ToString()));
}
try
{
......
}
catch (ResponseErrorException customError)
catch (ThirdPlatformException customError)
{
logHelper.Write(string.Format("商户查证可疑订单执行:{0},\r\n错误原因:{1}", JsonConvert.SerializeObject(item), customError.Message));
}
catch (Exception ex)
{
logHelper.Write(string.Format("商户查证可疑订单执行:{0},\r\n错误原因:{1}", JsonConvert.SerializeObject(item), ex.ToString()));
}
catch (ResponseErrorException customError)
catch (ThirdPlatformException customError)
{
logHelper.Write(string.Format("商户查证可疑订单执行:{0},\r\n错误原因:{1}", JsonConvert.SerializeObject(item), customError.Message));
}
这种东西根本就是自相矛盾的,customError 跟 customError 完全是两个不同种类的东西(只是命名相同),怎么纠结到一起?
原本分开写是很正常的,合并在一起反而不正常了。就好像我写代码if(....)
{
var a= "张三";
.......
}
else
{
var a= DateTime.Now;
.......
}
你告诉我你要把 a 合并吗?这显然是为了“形式上酷”而不管、抛弃了对变量 a 的内容理解的。