Classes | Core

Error : Exception : Object

superclass of all Errors
Subclasses: MethodError


Error and its subclasses separate different types of error is that can occur in the SuperCollider program into distinct classes, so that they can be reported differently to the user.

Anywhere that an error must be reported to the user and execution must stop, an error object must be created and thrown.

var file, path = "betcha-this-file-doesnt-exist.txt";
if((file = File(path, "r")).isOpen) {
    "File is % bytes long.\n".postf(file.length);
} {
    Error("File % could not be opened.".format(path)).throw;

For backward compatibility, .die() creates the error for you.

"Nothing is really wrong; just committing suicide for fun. A Harold and Maude moment.".die;

Throwing an error object gives the caller the opportunity to catch, and possibly recover from, the error. See the Exception help file for more information about this.

Error hierarchy

The following error classes exist in the main library.

The exact inheritance tree looks like this:

Class Methods

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods