[chuck-users] Best way to throw an error in ChucK?

Forrest Cahoon forrest.cahoon at gmail.com
Sat Oct 5 00:33:49 EDT 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20191004/a79e681e/attachment.html>


More information about the chuck-users mailing list