try..catch Usage – Unused Variable Warning

Sharing is Caring

Elminating the unused variable warning for a declaration in the catch block is very easy because you don’t need to assign to a variable.

See the below code for an example.

try {
}catch (Exception) {

Note: you should always log an exception if it isn’t expected. For example, for any IO Related exceptions you should probably log these.

Hope this helps.

Sharing is Caring