Catch Block Not Running
in
Contributed Library Questions
•
10 months ago
Hi, can anyone tell me, are there only certain types of code that I can run in a catch block?
Here's the code I'm running:
Here's the code I'm running:
import javax.sound.midi.*;
MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo();
MidiDevice device;
try {
device = MidiSystem.getMidiDevice(infos[11]);
} catch (MidiUnavailableException e) {
print("THIS WILL NEVER, EVER PRINT, EVER");
}
The catch block never executes, even though I know that particular exception is encountered (in fact it's encountered for every single one of my midi devices when I iterate through "infos" - but that's another topic). If I change the line inside the catch block to throw a general exception, it executes. But printing, assigning values to variables, etc. never execute inside the catch block.
1