I'm writing some code something like this:

class MyMidiThing
{
    // static int stores midi channels to use
    0 => static int nextChannel;

    // instance variable stores midi channel for object
    int channel;

    fun init()
    {
        if (nextChannel > 15) {
            // NO MORE MIDI CHANNELS!
            // PANIC! EXPLODE! ... how?
        }
        nextChannel => channel;
        nextChannel++;
        // ... go on to do stuff ...
    }
    // ...
}

Clearly I want to do something when there are no more MIDI channels available that stops the program and prints error info, like a stack trace.

In general programming terminology, to throw an exception.

I've been scanning the documentation, and maybe I'm dense, but I can't find out how to do what I want here.

Suggestions?

Forrest