Nested Try Catch in R
<p>I am trying to implement a nested tryCatch in R. The code is following:</p>

<pre><code>tryCatch({
    a &lt;- 2/'a'
    print(a)
    print("himanshu")

    tryCatch({
        a &lt;- 3/'a'
        print(a)
        print("inner loop") 

    }, warning = function(war) {
        print("Warning in inner tryCAtch")

    },  error = function(err) {
        print("Error in inner tryCAtch")
    })

 }, warning = function(war) {
        print("Warning in outer tryCAtch")

 }, error = function(err) {
    print("Error in outer tryCAtch")

 })
</code></pre>

<p>Even if there is an error in inner block the message of outer block are getting printed. I want the output like:</p>

<pre><code>Error in inner block
Error in outer block
</code></pre>