rev 529 - trunk/docs/tutorial
SVN User <[email protected]> Fri, 21 May 2004 15:19:53 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-05-21 15:19:49 -0400 (Fri, 21 May 2004)
New Revision: 529
Modified:
trunk/docs/tutorial/outline2.htm
trunk/docs/tutorial/tutorial11.htm
Log:
added raise keyword to tutorial
Modified: trunk/docs/tutorial/outline2.htm
===================================================================
--- trunk/docs/tutorial/outline2.htm 2004-05-21 17:28:52 UTC (rev 528)
+++ trunk/docs/tutorial/outline2.htm 2004-05-21 19:19:49 UTC (rev 529)
@@ -132,10 +132,10 @@
<li><a href="tutorial11.htm#lvasc">Raising an Exception</a>
<li><a href="tutorial11.htm#excobj">Exception Object</a>
<li><a href="tutorial11.htm#tryexc">Try Except Keywords</a>
- <li><a href="tutorial11.htm#sample">Example</a>
+ <li><a href="tutorial11.htm#sample">Example</a>
+ <li><a href="tutorial11.htm#raise">Raise Keyword</a>
</ul>
</ul>
-
</ul>
</td>
Modified: trunk/docs/tutorial/tutorial11.htm
===================================================================
--- trunk/docs/tutorial/tutorial11.htm 2004-05-21 17:28:52 UTC (rev 528)
+++ trunk/docs/tutorial/tutorial11.htm 2004-05-21 19:19:49 UTC (rev 529)
@@ -174,16 +174,12 @@
def func():
for i in 4:
- print i, 1/(i-2)
-
+ print i, 1/(i-2)
try:
func()
-
except Exception, err:
print "Exception:", err
-
print
-
func()</pre>
Output results (cleaned up):
<pre>0 -.5
@@ -192,13 +188,18 @@
0 -.5
1 -1
-
Uncaught exception:
--- File: C:\Prothon\pr\tutorial\tut18.pr, line: 8, char: 6
--- File: C:\Prothon\pr\tutorial\tut18.pr, line: 6, char: 24
Divide by zero Error</pre>
- <p> </p>
- </td>
+ <p><font face="Verdana, Arial, Helvetica, sans-serif" size="+2"><a name="raise"></a></font>You
+ can also raise an exception with the "raise" keyword. It has the form
+ "raise exc-obj, doc-obj". The "exc-obj" is the exception
+ object to be raised and must have Exception in its prototype chain.
+ The "doc-obj" may be any object but is usually a string. The
+ "doc-obj" is stored as an attribute of the "exc-obj"
+ with the name "doc_".</p>
+ </td>
</tr>
</table>
<table width="630" border="0" cellpadding="0" cellspacing="0">