summaryrefslogtreecommitdiffabout
path: root/htdocs/exceptions
Side-by-side diff
Diffstat (limited to 'htdocs/exceptions') (more/less context) (ignore whitespace changes)
-rw-r--r--htdocs/exceptions/compile.chtml2
-rw-r--r--htdocs/exceptions/index.chtml4
-rw-r--r--htdocs/exceptions/preprocess.chtml2
-rw-r--r--htdocs/exceptions/runtime.chtml2
4 files changed, 10 insertions, 0 deletions
diff --git a/htdocs/exceptions/compile.chtml b/htdocs/exceptions/compile.chtml
index aa4c8df..68dd034 100644
--- a/htdocs/exceptions/compile.chtml
+++ b/htdocs/exceptions/compile.chtml
@@ -1,50 +1,52 @@
% html(); return; /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
<%constructor>
b_strict = false;
+ PN_PREV("/exceptions/preprocess","preprocess","preprocessing errors");
+ PN_NEXT("/exceptions/runtime","runtime","runtime exceptions");
</%constructor>
<%codemethod string title() %>
return "compile-time exceptions handling";
</%codemethod>
<%method void content() %>
<h1>site-C-ing compile-time exception handling</h1>
<p>
Similar to <a href="/exceptions/preprocess">preprocessing exceptions</a>
there is a wide range of errors you may put into your code which will pass
through preprocessor and will be caught later at the compile-time.
</p>
<p>
Once you complete writing your <a
href="/view/htdocs/exceptions/development/compile.chtml" target="insert"
title="the link opens in the frame below">erroneous code</a> and
<em>site-C-ing</em> is done preprocessing it, it will feed the preprocessed
code into c++ compiler which will refuse to compile the code like this. This
is where <a href="/view/htdocs/handlers/exception_dev" target="insert"
title="the link opens in the frame below">the exception handler</a>,
specified in <a href="/view/htdocs/exceptions/development/.scrc"
target="insert" title="the link opens in the frame below">the configuration
file</a>, takes over the process and gives you <a
href="/exceptions/development/compile" target="insert" title="the link opens
in the frame below">the report</a>. Like with any handler, you may wish to
set some <a href="/view/htdocs/handlers/exception_prod" target="insert"
title="the link opens in the frame below">different handler</a> in your <a
href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
link opens in the frame below">production configuration</a>, which just gives
user <a href="/exceptions/production/preprocess" target="insert" title="the
link opens in the frame below">a friendly yet lame excuse</a>.
</p>
<p class="note">
Note, that these output pages are fakes -- I do not want to spawn the
compiler each time you want to see the output and put this unnecessary load
on cpu. These static pages are in fact saved output of the real exception
handlers.
</p>
<div class="insert">
<iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
<p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
support it. That is okay, it still will open links somehow.</p>
</iframe>
</div>
</%method>
diff --git a/htdocs/exceptions/index.chtml b/htdocs/exceptions/index.chtml
index cc0ed8a..e66620a 100644
--- a/htdocs/exceptions/index.chtml
+++ b/htdocs/exceptions/index.chtml
@@ -1,52 +1,56 @@
% html(); return; /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
+<%constructor>
+ PN_PREV("/simple","simple page","building a really simple page");
+ PN_NEXT("/exceptions/preprocess","preprocess","preprocessing errors");
+</%constructor>
<%codemethod string title() %>
return "exceptions handling";
</%codemethod>
<%method void content() %>
<h1>site-C-ing exception handling</h1>
<p>
The purpose of this section is to give an overview of the <em>site-C-ing</em>
exception handling mechanism. Before the web visitor can see the page each
site-C-ing component goes through a few stages, namely, preprocessing,
compiling and execution. Having three stages to go through also means the
stages one can fail to go through and three exciting opportunities to handle
different errors.
</p>
<p>
First each component is preprocessed so that you can feed the valid c++ code
to the compiler. Here is where the preprocessor can choke at your broken
source code. Once preprocessor failes to parse your code it will throw an
exception which <em>site-C-ing</em> will catch and pass to <a
href="/sources/htdocs/handlers/exception_dev" title="development mode
exception handler source">the exception handler component</a>. Want to <a
href="/exceptions/preprocess">read more</a> about preprocessor exception
handling?
</p>
<p>
After the preprocessing stage is over we have a great opportunity to catch
the compile-time errors. After <em>site-C-ing</em> fails to compile the
component it throws another exception and passes it to the same handler which
may show you some information on what's gone wrong with your source code from
the compiler's perspective. If you've gone this far you definitely want to <a
href="/exceptions/compile">read more</a> about the compiler error handling.
</p>
<p class="note">
Note, that it is likely that you will want to disable the steps above for the
production environment to save time on unnecessary checking whether the
component is up to date.
</p>
<p>
Finally, we need to execute the component and present its output to the web
site visitor. This is also where things may go wrong and here is where your
component may throw an exception for the engine to catch and pass to the
handler. Feel free to <a href="/exceptions/runtime">learn more</a> about it
as well.
</p>
<p class="note">
One more thing you will likely want to have differently in production
environment is <a href="/sources/htdocs/handlers/exception_prod"
title="production mode exception handler source">an exception handler</a>
which will not give out that much unnecessary information to the user.
</p>
</%method>
diff --git a/htdocs/exceptions/preprocess.chtml b/htdocs/exceptions/preprocess.chtml
index 8516139..88b8741 100644
--- a/htdocs/exceptions/preprocess.chtml
+++ b/htdocs/exceptions/preprocess.chtml
@@ -1,46 +1,48 @@
% html(); return; /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
<%constructor>
b_strict = false;
+ PN_PREV("/exceptions","exceptions","exception handling overview");
+ PN_NEXT("/exceptions/compile","compile-time","compile-time errors");
</%constructor>
<%codemethod string title() %>
return "preprocessor exceptions handling";
</%codemethod>
<%method void content() %>
<h1>site-C-ing preprocessor exception handling</h1>
<p>
It was one of those days when you just can't type right and can't think of
what you're typing. It is not unusual that, under such circumstances, you end
up with a code like <a
href="/view/htdocs/exceptions/development/preprocess.chtml" target="insert"
title="the link opens in the frame below">this</a> -- by the time you were
about to close your <code>&lt;%code&gt;</code> block you were thinking about
some constructor in some component elsewhere in the universe.
</p>
<p>
<em>site-C-ing</em> parser will see the inconsistency and throw an exception
which will be caught and passed to <a
href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
opens in the frame below">the handler</a>, specified in <a
href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
link opens in the frame below">the configuration file</a>, which will produce
some nice, human-readable <a href="/exceptions/development/preprocess"
target="insert" title="the link opens in the frame below">output</a>. Well,
you may not wish to give out all this information in the production
environment, so you just put in your <a
href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
link opens in the frame below">configuration file</a> some <a
href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
opens in the frame below">different handler</a>, which just gives user <a
href="/exceptions/production/preprocess" target="insert" title="the link
opens in the frame below">a friendly yet lame excuse</a>.
</p>
<div class="insert">
<iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
<p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
support it. That is okay, it still will open links somehow.</p>
</iframe>
</div>
</%method>
diff --git a/htdocs/exceptions/runtime.chtml b/htdocs/exceptions/runtime.chtml
index d0a8e14..9a72afd 100644
--- a/htdocs/exceptions/runtime.chtml
+++ b/htdocs/exceptions/runtime.chtml
@@ -1,47 +1,49 @@
% html(); return; /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
<%constructor>
b_strict = false;
+ PN_PREV("/exceptions/compile","compile-time","compile-time errors");
+ PN_NEXT("/sources","sources","source browser");
</%constructor>
<%codemethod string title() %>
return "runtime exceptions handling";
</%codemethod>
<%method void content() %>
<h1>site-C-ing runtime exception handling</h1>
<p>
The component may throw an exception while executing and the
<em>site-C-ing</em> will gladly pass it to the handler component which will
give the user appropriate output (unless it throws an exception itself, of
course). Here you will see an example output provided by the handler bundled
with the <em>site-C-ing</em>.
</p>
<p>
Suppose you have <a href="/view/htdocs/exceptions/development/runtime.chtml"
target="insert" title="the link opens in the frame below">a component</a>,
which at some point throws an exception. Of course, <em>site-C-ing</em> will
catch the exception and pass it to <a
href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
opens in the frame below">the handler</a>, specified in <a
href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
link opens in the frame below">the configuration file</a>, which will produce
some nice, human-readable <a href="/exceptions/development/runtime"
target="insert" title="the link opens in the frame below">output</a>. Well,
you may not wish to give out all this information in the production
environment, so you just put in your <a
href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
link opens in the frame below">configuration file</a> some <a
href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
opens in the frame below">different handler</a>, which just gives user <a
href="/exceptions/production/runtime" target="insert" title="the link opens
in the frame below">a friendly yet lame excuse</a>.
</p>
<div class="insert">
<iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
<p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
support it. That is okay, it still will open links somehow.</p>
</iframe>
</div>
</%method>