3 summary::superclass of all Errors
6 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.
8 Anywhere that an error must be reported to the user and execution must stop, an error object must be created and thrown.
11 var file, path = "betcha-this-file-doesnt-exist.txt";
12 if((file = File(path, "r")).isOpen) {
13 "File is % bytes long.\n".postf(file.length);
16 Error("File % could not be opened.".format(path)).throw;
21 For backward compatibility, code::.die():: creates the error for you.
24 "Nothing is really wrong; just committing suicide for fun. A Harold and Maude moment.".die;
27 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.
29 subsection::Error hierarchy
31 The following error classes exist in the main library.
34 ## link::Classes/Error::
35 ## link::Classes/DeprecatedError:: : this method is no longer supported.
36 ## link::Classes/MethodError:: : generic error occurring within a method.
37 ## link::Classes/DoesNotUnderstandError:: : the receiver does not understand the method name.
38 ## link::Classes/BinaryOpFailureError:: : a binary operator cannot work with the operand classes.
39 ## link::Classes/ImmutableError:: : attempted to modify an immutable object.
40 ## link::Classes/MustBeBooleanError:: : a test (in if or while) returned a non-Boolean value.
41 ## link::Classes/NotYetImplementedError:: : the method name exists, but isn't implemented yet.
42 ## link::Classes/OutOfContextReturnError:: : a method return by ^ took place outside of a method.
43 ## link::Classes/PrimitiveFailedError:: : an error occurred inside a primitive.
44 ## link::Classes/ShouldNotImplementError:: : you called a method on a class that has no business implementing it.
45 ## link::Classes/SubclassResponsibilityError:: : you called a method on an abstract class.
48 The exact inheritance tree looks like this: