sollte ich meinen gesamten WCF-Dienstcode in einen Try-Catch-Block einschließen?

<code>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);
}
</code>

Sollte ich alles in einen Try-Catch einwickeln, oder was empfehlen Sie? Ich verwende WCF mit anderen JSON-Diensten

Antworten auf die Frage(1)

Ihre Antwort auf die Frage