Can IDEA wrap generate checked exception block automatically?

Many classes, when you instantiate them, force you to wrap the call in try/catch because they use checked exceptions.

When you try and compile you get an error.

Can/does IDEA realize this and give you a shortcut to wrap it with the correct exception type?

1 comment
Comment actions Permalink

Sure, IDEA highlights unhandled checked exception and provides easy way to handle it (offers to choose between propagation and handling 'in place').

You should put caret on a problem expression and press 'Alt+Enter'. Basically, you should press 'Alt+Enter' every time you think 'it would be cool if IDEA...'. We call that Programming by Intention


Please sign in to leave a comment.