1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.42">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
15 span
.s1
{font: 18.0px Helvetica
}
16 span
.s2
{color: #263bcc}
17 span
.s3
{color: #0000ff}
18 span
.s4
{color: #0012b9}
19 span
.s5
{color: #000000}
20 span
.s6
{color: #606060}
21 span
.Apple-tab-span
{white-space:pre
}
25 <p class=
"p1"><span class=
"s1"><b>Error
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>superclass of all Errors
</b></p>
26 <p class=
"p2"><br></p>
27 <p class=
"p1"><b>Inherits from:
</b><a href=
"Object.html"><span class=
"s2"><b>Object
</b></span></a><b> :
</b><a href=
"Exception.html"><span class=
"s3"><b>Exception
</b></span></a></p>
28 <p class=
"p2"><br></p>
29 <p class=
"p1">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.
</p>
30 <p class=
"p2"><br></p>
31 <p class=
"p1">Anywhere that an error must be reported to the user and execution must stop, an error object must be created and thrown.
</p>
32 <p class=
"p2"><br></p>
34 <p class=
"p4"><span class=
"s4">var
</span><span class=
"s5"> file, path =
</span>"betcha-this-file-doesnt-exist.txt"<span class=
"s5">;
</span></p>
35 <p class=
"p3">if((file =
<span class=
"s4">File
</span>(path,
<span class=
"s6">"r"</span>)).isOpen) {
</p>
36 <p class=
"p4"><span class=
"s5"><span class=
"Apple-tab-span"> </span></span>"File is % bytes long.\n"<span class=
"s5">.postf(file.length);
</span></p>
37 <p class=
"p3"><span class=
"Apple-tab-span"> </span>file.close;
</p>
39 <p class=
"p4"><span class=
"s5"><span class=
"Apple-tab-span"> </span></span><span class=
"s4">Error
</span><span class=
"s5">(
</span>"File % could not be opened."<span class=
"s5">.format(path)).throw;
</span></p>
42 <p class=
"p2"><br></p>
43 <p class=
"p1">For backward compatibility, .die() creates the error for you.
</p>
44 <p class=
"p2"><br></p>
45 <p class=
"p4">"Nothing is really wrong; just committing suicide for fun. A Harold and Maude moment."<span class=
"s5">.die;
</span></p>
46 <p class=
"p2"><br></p>
47 <p class=
"p1">Throwing an error object gives the caller the opportunity to catch, and possibly recover from, the error. See the
<a href=
"Exception.html"><span class=
"s3">Exception
</span></a> help file for more information about this.
</p>
48 <p class=
"p2"><br></p>
49 <p class=
"p5"><b>Error hierarchy
</b></p>
50 <p class=
"p2"><br></p>
51 <p class=
"p1">The following error classes exist in the main library.
</p>
52 <p class=
"p2"><br></p>
53 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span>Error
</b></p>
54 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>DeprecatedError:
</b> this method is no longer supported.
</p>
55 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>MethodError:
</b> generic error occurring within a method.
</p>
56 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>DoesNotUnderstandError:
</b> the receiver does not understand the method name.
</p>
57 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>BinaryOpFailureError:
</b> a binary operator cannot work with the operand classes.
</p>
58 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>ImmutableError:
</b> attempted to modify an immutable object.
</p>
59 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>MustBeBooleanError:
</b> a test (in if or while) returned a non-Boolean value.
</p>
60 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>NotYetImplementedError:
</b> the method name exists, but isn't implemented yet.
</p>
61 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>OutOfContextReturnError:
</b> a method return by ^ took place outside of a method.
</p>
62 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>PrimitiveFailedError:
</b> an error occurred inside a primitive.
</p>
63 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>ShouldNotImplementError:
</b> you called a method on a class that has no business implementing it.
</p>
64 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>SubclassResponsibilityError:
</b> you called a method on an abstract class.
</p>