Enclose[WithCleanup[Echo[1], Confirm[$Failed, Null, "abc"]; Echo[2], Echo[3]], Identity, "def"]
WithCleanup[Echo[1], Quit[]; Echo[2], Echo[3]]
WithCleanup[Echo[1], Integrate[Divisible[x]/Log[x], x]; Echo[2], Echo[3]]
WithCleanup[savelimit=$RecursionLimit;$RecursionLimit = Infinity;lg[x_] := If[x==0,1,x + lg[x - 1]];Echo[1], Echo[h[lg[10^6],expl]]; Echo[2], $RecursionLimit = savelimit;Clear[lg];Echo[3]]
WithCleanup[Echo[1], Quit[]; Echo[2], Echo[3]]
WithCleanup[Echo[1], Integrate[Divisible[x]/Log[x], x]; Echo[2], Echo[3]]
WithCleanup[savelimit=$RecursionLimit;$RecursionLimit = Infinity;lg[x_] := If[x==0,1,x + lg[x - 1]];Echo[1], Echo[h[lg[10^6],expl]]; Echo[2], $RecursionLimit = savelimit;Clear[lg];Echo[3]]