2011-07-27 87 views
0

我try块中的代码看起来像下面的东西:WebProtocolException是未处理由用户代码

catch (ThinkBusinessLogicException ex) 
{ 
    var message = (ex.InnerException != null) ? ex.InnerException.ToString() : ex.Message; 

    if (message == "CustomerID in A does not match customerId in B") 
    { 
     Error = new ErrorStore("400", "1", "CustomerID in A does not match customerId in B"); 
     throw new WebProtocolException(HttpStatusCode.BadRequest, Error.Description, Error.Generate(), null, null); 
    } 

    throw new WebProtocolException(HttpStatusCode.InternalServerError, message, new ErrorStore("500", "1", message).Generate(), null, null); 
} 

什么情况是,满足条件,并在条件WebProtolException满足和抛出。然而,在调试outter时,WebProtocolException也被抛出,声明“A中的WebProtocolException CustomerID与用户代码未处理的B中的customerId不匹配”。

但是,当我看看小提琴手时,会显示400的状态码,并在小提琴手的原始选项卡上显示正确的具有该信息的badrequest响应。

我很困惑为什么第二个WebProtocol未被用户代码处理。

任何建议,非常感谢!

扎尔

回答

相关问题