If you are never using the catch exception, you could just do this:
<div>
@{
try
{
//some code
<div>yes</div>
}
catch
{
<div>error</div>
}
}
</div>
Whilst I think wrapping pragmas around your catch simply to ignore a warning about an unused variable is, frankly, a hideous proposal (not only does it look ugly, but I think it reduces readability, and confuses matters - are you using the variable or not?), if you really need to do that, try this:
<div>
@{
try
{
//some code
throw new SystemException();
<div>yes</div>
}
catch
(
#pragma warning disable 0168
SystemException e
#pragma warning restore 0168
)
{
<div>error</div>
}
}
</div>