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
me.crash() is what I use.
On Sat, 5 Oct 2019 at 05:34, Forrest Cahoon
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
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (2)
-
Anthony Bowyer-Lowe
-
Forrest Cahoon