how to make sure a variable is set to a value and it can if tested in catch block
<p>I am writing a proof of concept with a simple requirement where I load an account, make a webservice call to initiate payment and if it is successful update the account balance. </p>

<p>The intention of following code is to make sure some reversal is done if web service call was successful in taking money out of customer' bank but account could not be saved due to concurrency issue. However, I have this strange issue that even if response is successful, the <strong>if test in catch block</strong> returns false and the exception is re thrown? </p>

<p><strong>edit begin:</strong></p>

<p>if <code>response.IsSuccessful</code> is <code>true</code> and <code>ConcurrencyException</code> occurs at <code>accountService.Save(account)</code> line, shouldn't <code>currentStatus</code> be equal to <strong>WEBSERVICE_SUCCESSFUL</strong> ?</p>

<p><strong>edit end:</strong></p>

<p>This is a web application and call to <strong>Process()</strong> is triggered by front end. Am I missing anything obvious? Any help would be really appreciated.</p>

<pre><code>function void Process(Account account, string param1, decimal param2) {
    string currentStatus = "START";
    try
    {
        log("Begin web service call"); 
        var response = webservice.Call(param, param2);
        log("End web service call");

        if(response.IsSuccessful)
        {
           currentStatus = "WEBSERVICE_SUCCESSFUL";
             //update account balance 
             accountService.Save(account);
        }
        else
           {
            // do something else
           }
    }
    catch (ConcurrencyException ex)
    {
        log("Error concurrency..");
        if( currentStatus == "WEBSERVICE_SUCCESSFUL")
            //do reversal 
        else
           throw ex;
    }
}
</code></pre>
