try
{
///// here is the code that might throw erros. If I discover the user is unauthorized I throw a WebFaultException myself to alert the client
}
catch (WebFaultException ex)
{
throw ex; //but if I wrap all code in try-catch, I have to rethrow the exception o the status code reaches the client
}
catch (Exception ex)
{
throw new WebFaultException(ex.Message, HttpStatusCode.InternalServerError);
}
Должен ли я обернуть все в try -catch, или что вы порекомендуете? Я использую WCF с остальными -полными службами JSON