summaryrefslogtreecommitdiff
path: root/doc/plugins
diff options
context:
space:
mode:
authorSimon McVittie <smcv@carbon.pseudorandom.co.uk>2008-07-14 22:22:39 +0100
committerSimon McVittie <smcv@carbon.pseudorandom.co.uk>2008-07-14 22:22:39 +0100
commita65d312467c5ab179ecf4aa715790f371a46634a (patch)
tree7565862f3e2f86a1e9ff623d991f3150860230a4 /doc/plugins
parent31bc223abbe0ec1990921b4bab85f074431b0c1d (diff)
parent66053f6fc7b300c9b49a5c69d2c7a1eeec841743 (diff)
Merge branch 'master' of git://git.ikiwiki.info
Diffstat (limited to 'doc/plugins')
-rw-r--r--doc/plugins/write.mdwn13
-rw-r--r--doc/plugins/write/tutorial.mdwn4
2 files changed, 9 insertions, 8 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($;@)`
diff --git a/doc/plugins/write/tutorial.mdwn b/doc/plugins/write/tutorial.mdwn
index 8b12fd183..94b72c763 100644
--- a/doc/plugins/write/tutorial.mdwn
+++ b/doc/plugins/write/tutorial.mdwn
@@ -169,7 +169,7 @@ be a guard on how high it will go.
}
my $num=$last{$page}++;
if ($num > 25) {
- return "[[fib will only calculate the first 25 numbers in the sequence]]";
+ error "can only calculate the first 25 numbers in the sequence";
}
return fib($num);
}
@@ -182,7 +182,7 @@ does for numbers less than 1. Or for any number that's not an integer. In
either case, it will run forever. Here's one way to fix that:
if (int($num) != $num || $num < 1) {
- return "[[fib positive integers only, please]]";
+ error "positive integers only, please";
}
As these security problems have demonstrated, even a simple input from the