]> gitweb.factorcode.org Git - factor.git/commitdiff
python: docs for python-error
authorBjörn Lindqvist <bjourne@gmail.com>
Thu, 2 Oct 2014 15:19:05 +0000 (17:19 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 2 Oct 2014 15:32:39 +0000 (08:32 -0700)
extra/python/python-docs.factor
extra/python/python.factor
extra/python/throwing/throwing.factor

index a32bbe50431342bfc73d808a955eddd6d68704fb..2d78f8bd70ad0d99fc66106ae1e2622687f4900b 100644 (file)
@@ -1,5 +1,5 @@
 IN: python
-USING: python help.markup help.syntax ;
+USING: python python.throwing help.markup help.syntax ;
 
 HELP: py-initialize
 { $description "Initializes the python binding. This word must be called before any other words in the api can be used" } ;
@@ -19,9 +19,16 @@ HELP: >py
 }
 { $see-also py> } ;
 
+HELP: python-error
+{ $error-description "When Python throws an exception, it is translated to this Factor error. " { $slot "type" } " is the class name of the python exception object, " { $slot "message" } " its string and " { $slot "traceback" } " a sequence of traceback lines, if the error has one, or " { $link f } " otherwise." } ;
+
 ARTICLE: "python" "Python binding"
 "The " { $vocab-link "python" } " vocab and its subvocabs implements a simple binding for libpython, allowing factor code to call native python."
 $nl
+"Converting to and from Python:"
+{ $subsections >py py> }
+"Error handling:"
+{ $subsections python-error }
 "Initialization and finalization:"
 { $subsections py-initialize py-finalize }
 "Module management:"
index c40840c9c5339f10f60af33a7ce4933c691111ab..a298fd196cfd5389bd09ee658f02452f21f99fcb 100644 (file)
@@ -5,6 +5,8 @@ specialized-arrays strings vectors ;
 IN: python
 QUALIFIED: math
 
+ERROR: python-error type message traceback ;
+
 SPECIALIZED-ARRAY: void*
 
 ! Borrowed from unix.utilities
index e12bd263e309660675973af68459567ced4029af..4cdf539d48d4b04fa144824335db758789db78a1 100644 (file)
@@ -1,8 +1,6 @@
 USING: arrays kernel python python.ffi python.syntax sequences ;
 IN: python.throwing
 
-ERROR: python-error type message traceback ;
-
 PY-FROM: traceback => format_tb ( tb -- seq ) ;
 
 PY-METHODS: obj =>