[chuck-users] Best way to throw an error in ChucK?
Anthony Bowyer-Lowe
anthony at lowbroweye.com
Sat Oct 5 03:35:12 EDT 2019
me.crash() is what I use.
On Sat, 5 Oct 2019 at 05:34, Forrest Cahoon <forrest.cahoon at gmail.com>
wrote:
> 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 at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20191005/9a7c75af/attachment.html>
More information about the chuck-users
mailing list