Dealing with thrown exceptions is easy. Unhandled exceptions are detected while typing and marked with a red line in the editor.
- Click on the light bulb or press Ctrl+1 to surround the call with a try catch block. If you want to include more statements in the try block, select the statements and use Source > Surround With try/catch Block. You can also select individual statements by using Edit > Expand Selection to and selecting Enclosing, Next or Previous.
- If the call is already surrounded with a try block, Quick Fix will suggest adding the catch block to the existing block.
- If you don't want to handle the exception, let Quick Fix add a new thrown exception to the enclosing method declaration.
At any time you can convert a catch block to a thrown exception. Use Ctrl+1 (Edit > Quick Fix) on a catch block.