summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-13 14:41:40 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-13 14:41:40 -0400
commitedb59cd5b949de7a68f3b74e7949bf3893b23c6a (patch)
tree036db895d4013c4d5b7ae2cb39b5c26ef6f8fa66 /doc
parent2bd4dea7f029f30b4b07ba2e91358f5c3bf04a10 (diff)
Error handling improvement for preprocess hooks. It's now safe to call error() from such hooks; it will cause a nicely formatted error message to be inserted into the page.
Diffstat (limited to 'doc')
-rw-r--r--doc/plugins/write.mdwn13
1 files changed, 7 insertions, 6 deletions
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 6b49ec58d..4dc55e302 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -412,12 +412,13 @@ Aborts with an error message. If the second parameter is passed, it is a
function that is called after the error message is printed, to do any final
cleanup.
-Note that while any plugin can use this for a fatal error, plugins should
-try to avoid dying on bad input when building a page, as that will halt
-the entire wiki build and make the wiki unusable. So for example, if a
-[[ikiwiki/PreProcessorDirective]] is passed bad parameters, it's better to
-return an error message, which can appear on the wiki page, rather than
-calling error().
+If called inside a preprocess hook, error() does not abort the entire
+wiki build, but instead replaces the [[ikiwiki/PreProcessorDirective]] with
+a version containing the error message.
+
+In other hooks, error() is a fatal error, so use with care. Try to avoid
+dying on bad input when building a page, as that will halt
+the entire wiki build and make the wiki unusable.
#### `template($;@)`