summaryrefslogtreecommitdiffabout
path: root/htdocs/exceptions
authorMichael Krelin <hacker@klever.net>2005-01-30 00:57:53 (UTC)
committer Michael Krelin <hacker@klever.net>2005-01-30 00:57:53 (UTC)
commit71f4cc84c3788c6904ede17cd626a9ca9c349e3b (patch) (unidiff)
treecfe7736ae3416ad314b7451b756e587335c357c7 /htdocs/exceptions
parentacd2a536dd6bb3ef9438482725f77ac9044ae79b (diff)
downloadsitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.zip
sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.tar.gz
sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.tar.bz2
initial commit into repository
Diffstat (limited to 'htdocs/exceptions') (more/less context) (ignore whitespace changes)
-rw-r--r--htdocs/exceptions/compile.chtml50
-rw-r--r--htdocs/exceptions/development/.htaccess3
-rw-r--r--htdocs/exceptions/development/.scrc2
-rw-r--r--htdocs/exceptions/development/compile.chtml12
-rw-r--r--htdocs/exceptions/development/compile.html248
-rw-r--r--htdocs/exceptions/development/erroneous.h1
-rw-r--r--htdocs/exceptions/development/preprocess.chtml14
-rw-r--r--htdocs/exceptions/development/runtime.chtml16
-rw-r--r--htdocs/exceptions/index.chtml52
-rw-r--r--htdocs/exceptions/preprocess.chtml46
-rw-r--r--htdocs/exceptions/production/.htaccess3
-rw-r--r--htdocs/exceptions/production/.scrc2
-rw-r--r--htdocs/exceptions/production/compile.chtml12
-rw-r--r--htdocs/exceptions/production/compile.html44
-rw-r--r--htdocs/exceptions/production/erroneous.h1
-rw-r--r--htdocs/exceptions/production/preprocess.chtml14
-rw-r--r--htdocs/exceptions/production/runtime.chtml16
-rw-r--r--htdocs/exceptions/runtime.chtml47
18 files changed, 583 insertions, 0 deletions
diff --git a/htdocs/exceptions/compile.chtml b/htdocs/exceptions/compile.chtml
new file mode 100644
index 0000000..90ee7d8
--- a/dev/null
+++ b/htdocs/exceptions/compile.chtml
@@ -0,0 +1,50 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%constructor>
4 b_strict = false;
5</%constructor>
6<%codemethod string title() %>
7 return "compile-time exceptions handling";
8</%codemethod>
9<%method void content() %>
10 <h1>site-C-ing compile-time exception handling</h1>
11 <p>
12 Similar to <a href="/exceptions/preprocess">preprocessing exceptions</a>
13 there is a wide range of errors you may put into your code which will pass
14 through preprocessor and will be caught later at the compile-time.
15 </p>
16 <p>
17 Once you complete writing your <a
18 href="/view/htdocs/exceptions/development/compile.chtml" target="insert"
19 title="the link opens in the frame below">erroneous code</a> and
20 <em>site-C-ing</em> is done preprocessing it, it will feed the preprocessed
21 code into c++ compiler which will refuse to compile the code like this. This
22 is where <a href="/view/htdocs/handlers/exception_dev" target="insert"
23 title="the link opens in the frame below">the exception handler</a>,
24 specified in <a href="/view/htdocs/exceptions/development/.scrc"
25 target="insert" title="the link opens in the frame below">the configuration
26 file</a>, takes over the process and gives you <a
27 href="/exceptions/development/compile" target="insert" title="the link opens
28 in the frame below">the report</a>. Like with any handler, you may wish to
29 set some <a href="/view/htdocs/handlers/exception_prod" target="insert"
30 title="the link opens in the frame below">different handler</a> in your <a
31 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
32 link opens in the frame below">production configuration</a>, which just gives
33 user <a href="/exceptions/production/preprocess" target="insert" title="the
34 link opens in the frame below">a friendly yet lame excuse</a>.
35 </p>
36 <p class="note">
37 Note, that these output pages are fakes -- I do not want to spawn the
38 compiler each time you want to see the output and put this unnecessary load
39 on cpu. These static pages are in fact saved output of the real exception
40 handlers.
41 </p>
42
43 <div class="insert">
44 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300" border="1">
45 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
46 support it. That is okay, it still will open links somehow.</p>
47 </iframe>
48 </div>
49
50</%method>
diff --git a/htdocs/exceptions/development/.htaccess b/htdocs/exceptions/development/.htaccess
new file mode 100644
index 0000000..01cb5ec
--- a/dev/null
+++ b/htdocs/exceptions/development/.htaccess
@@ -0,0 +1,3 @@
1<Files compile.chtml>
2 deny from all
3</Files>
diff --git a/htdocs/exceptions/development/.scrc b/htdocs/exceptions/development/.scrc
new file mode 100644
index 0000000..da24ef7
--- a/dev/null
+++ b/htdocs/exceptions/development/.scrc
@@ -0,0 +1,2 @@
1ExceptionHandler /handlers/exception_dev
2AutoBuildFiles -*
diff --git a/htdocs/exceptions/development/compile.chtml b/htdocs/exceptions/development/compile.chtml
new file mode 100644
index 0000000..3611ca9
--- a/dev/null
+++ b/htdocs/exceptions/development/compile.chtml
@@ -0,0 +1,12 @@
1<html>
2 <head>
3 <title>I'm gonna make a number of mistakes!</title>
4 </head>
5 <body>
6% ind a = 2;
7% #include "erroneous.h"
8% unsigned int a = -1;
9% int j = k;
10 </body>
11</html>
12% /* vim:set ft=sitecing: */
diff --git a/htdocs/exceptions/development/compile.html b/htdocs/exceptions/development/compile.html
new file mode 100644
index 0000000..c3384a2
--- a/dev/null
+++ b/htdocs/exceptions/development/compile.html
@@ -0,0 +1,248 @@
1
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4 <head>
5 <title>failed to compile component</title>
6 <style type="text/css">
7 <!--
8 body {
9 font-family: sans-serif;
10 font-size: 11pt;
11 }
12
13 h1 {
14 font-family: serif;
15 font-size: 130%;
16 font-weight: bold;
17 text-align: center;
18 }
19 p {
20 text-indent: 2em;
21 text-align: justify;
22 }
23
24 dl.exception-props {
25 margin: 1ex 1em;
26 padding: 0.5ex;
27 border: solid 1px gray;
28 background-color: #e0e0e0;
29 }
30 dl.exception-props dt {
31 font-weight: bold;
32 color: blue;
33 }
34 dl.exception-props dd {
35 color: gray;
36 }
37
38 div.exception-codepoint-report {
39 border: solid 1px black;
40 margin: 0.5ex 1em 0.ex 3em;
41 }
42 div.exception-codepoint-report h3 {
43 display: block;
44 color: blue;
45 border-bottom: 3px double black;
46 padding: 0.3ex; margin: 0px;
47 background: #e0e0e0;
48 }
49 div.exception-codepoint-report ul {
50 padding: 0px;
51 margin: 0px;
52 background: #87fdff;
53 font-size: 70%;
54 }
55 div.exception-codepoint-report li {
56 font-family: monospace;
57 list-style-type: none;
58 white-space: pre;
59 overflow: hidden;
60 }
61 div.exception-codepoint-report li.focused {
62 color: red;
63 border-top: solid 1px red; border-bottom: solid 1px red;
64 }
65 div.exception-codepoint-report li .lineno {
66 padding-right: 0.5ex;
67 border-right: dotted black 1px;
68 }
69 div.exception-codepoint-report div.what {
70 border-top: double 3px black;
71 padding: 0.5ex 2em;
72 font-weight: bold; color: #4040c0;
73 overflow: auto;
74 }
75 div.backtrace div.exception-codepoint-report div.what {
76 color: gray;
77 }
78
79 div.exception-compile div.what {
80 font-weight: normal;
81 color: red;
82 }
83
84 div.powered {
85 margin: 2em 0px 0px 50%;
86 padding: 1ex 2ex;
87 text-align: right;
88 font-family: serif;
89 font-size: 140%;
90 font-weight: bold;
91 border-top: solid 2px black;
92 border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
93 background: #c0c0f0;
94 }
95 -->
96 </style>
97 </head>
98 <body>
99
100 <div class="exception-compile">
101 <h1>error compiling component '<code>exceptions/development/compile.chtml</code>'</h1>
102
103 <div class="exception-codepoint-report">
104 <h3>exceptions/development/compile.chtml</h3>
105 <ul>
106 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;1</span>&nbsp;<span class="line">&lt;html&gt;</span></li>
107
108 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line">&nbsp;&lt;head&gt;</span></li>
109
110 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;3</span>&nbsp;<span class="line">&nbsp;&nbsp;&lt;title&gt;I'm&nbsp;gonna&nbsp;make&nbsp;a&nbsp;number&nbsp;of&nbsp;mistakes!&lt;/title&gt;</span></li>
111
112 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
113
114 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
115
116 <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;<span class="line">%&nbsp;&nbsp;ind&nbsp;a&nbsp;=&nbsp;2;</span></li>
117
118 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
119
120 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;8</span>&nbsp;<span class="line">%&nbsp;&nbsp;unsigned&nbsp;int&nbsp;a&nbsp;=&nbsp;-1;</span></li>
121
122 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;9</span>&nbsp;<span class="line">%&nbsp;&nbsp;int&nbsp;j&nbsp;=&nbsp;k;</span></li>
123
124 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
125
126 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
127 </ul>
128 <div class="what">
129 exceptions/development/compile.chtml: In member function `virtual void _SCC_exceptions_development_compile_chtml::main(int, char*)':<br/>
130exceptions/development/compile.chtml:6: error: `ind' undeclared (first use this function)<br/>
131exceptions/development/compile.chtml:6: error: (Each undeclared identifier is reported only once for each function it appears in.)<br/>
132exceptions/development/compile.chtml:6: error: expected `;' before "a"
133 </div>
134 </div>
135
136 <div class="exception-codepoint-report">
137 <h3>exceptions/development/compile.chtml</h3>
138 <ul>
139 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line">&nbsp;&lt;head&gt;</span></li>
140
141 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;3</span>&nbsp;<span class="line">&nbsp;&nbsp;&lt;title&gt;I'm&nbsp;gonna&nbsp;make&nbsp;a&nbsp;number&nbsp;of&nbsp;mistakes!&lt;/title&gt;</span></li>
142
143 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
144
145 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
146
147 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;<span class="line">%&nbsp;&nbsp;ind&nbsp;a&nbsp;=&nbsp;2;</span></li>
148
149 <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
150
151 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;8</span>&nbsp;<span class="line">%&nbsp;&nbsp;unsigned&nbsp;int&nbsp;a&nbsp;=&nbsp;-1;</span></li>
152
153 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;9</span>&nbsp;<span class="line">%&nbsp;&nbsp;int&nbsp;j&nbsp;=&nbsp;k;</span></li>
154
155 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
156
157 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
158
159 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;12</span>&nbsp;<span class="line">%&nbsp;/*&nbsp;vim:set&nbsp;ft=sitecing:&nbsp;*/</span></li>
160 </ul>
161 <div class="what">
162 In file included from exceptions/development/compile.chtml:7:
163 </div>
164 </div>
165
166 <div class="exception-codepoint-report">
167 <h3>exceptions/development/erroneous.h</h3>
168 <ul>
169 <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;1</span>&nbsp;<span class="line">&nbsp;a+2=5;</span></li>
170
171 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line"></span></li>
172 </ul>
173 <div class="what">
174 ./erroneous.h:1: error: `a' undeclared (first use this function)
175 </div>
176 </div>
177
178 <div class="exception-codepoint-report">
179 <h3>exceptions/development/compile.chtml</h3>
180 <ul>
181 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;3</span>&nbsp;<span class="line">&nbsp;&nbsp;&lt;title&gt;I'm&nbsp;gonna&nbsp;make&nbsp;a&nbsp;number&nbsp;of&nbsp;mistakes!&lt;/title&gt;</span></li>
182
183 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
184
185 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
186
187 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;<span class="line">%&nbsp;&nbsp;ind&nbsp;a&nbsp;=&nbsp;2;</span></li>
188
189 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
190
191 <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;8</span>&nbsp;<span class="line">%&nbsp;&nbsp;unsigned&nbsp;int&nbsp;a&nbsp;=&nbsp;-1;</span></li>
192
193 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;9</span>&nbsp;<span class="line">%&nbsp;&nbsp;int&nbsp;j&nbsp;=&nbsp;k;</span></li>
194
195 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
196
197 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
198
199 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;12</span>&nbsp;<span class="line">%&nbsp;/*&nbsp;vim:set&nbsp;ft=sitecing:&nbsp;*/</span></li>
200
201 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;13</span>&nbsp;<span class="line"></span></li>
202 </ul>
203 <div class="what">
204 exceptions/development/compile.chtml:8: warning: converting of negative value `-0x000000001' to `unsigned int'
205 </div>
206 </div>
207
208 <div class="exception-codepoint-report">
209 <h3>exceptions/development/compile.chtml</h3>
210 <ul>
211 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
212
213 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
214
215 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;<span class="line">%&nbsp;&nbsp;ind&nbsp;a&nbsp;=&nbsp;2;</span></li>
216
217 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
218
219 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;8</span>&nbsp;<span class="line">%&nbsp;&nbsp;unsigned&nbsp;int&nbsp;a&nbsp;=&nbsp;-1;</span></li>
220
221 <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;9</span>&nbsp;<span class="line">%&nbsp;&nbsp;int&nbsp;j&nbsp;=&nbsp;k;</span></li>
222
223 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
224
225 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
226
227 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;12</span>&nbsp;<span class="line">%&nbsp;/*&nbsp;vim:set&nbsp;ft=sitecing:&nbsp;*/</span></li>
228
229 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;13</span>&nbsp;<span class="line"></span></li>
230 </ul>
231 <div class="what">
232 exceptions/development/compile.chtml:9: error: `k' undeclared (first use this function)<br/>
233
234 </div>
235 </div>
236
237 </div>
238
239 <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
240 </body>
241</html>
242
243
244
245
246
247
248
diff --git a/htdocs/exceptions/development/erroneous.h b/htdocs/exceptions/development/erroneous.h
new file mode 100644
index 0000000..060a57e
--- a/dev/null
+++ b/htdocs/exceptions/development/erroneous.h
@@ -0,0 +1 @@
a+2=5;
diff --git a/htdocs/exceptions/development/preprocess.chtml b/htdocs/exceptions/development/preprocess.chtml
new file mode 100644
index 0000000..f7405e7
--- a/dev/null
+++ b/htdocs/exceptions/development/preprocess.chtml
@@ -0,0 +1,14 @@
1<html>
2 <body>
3 <p>
4 I was writing this component in a hurry, having a lot of things to distract
5 me, so no wonder I made mistake.
6 <%code>
7 /* I do not even remember what I was going to put in this code block. And
8 * of course I didn't mean to forget that this is just a block of code, not
9 * a constructor...
10 */
11 </%constructor>
12 </p>
13 </body>
14</html>
diff --git a/htdocs/exceptions/development/runtime.chtml b/htdocs/exceptions/development/runtime.chtml
new file mode 100644
index 0000000..4a494bd
--- a/dev/null
+++ b/htdocs/exceptions/development/runtime.chtml
@@ -0,0 +1,16 @@
1%%decl #include <konforka/exception.h>
2<%code>
3 try{
4 try{
5 try{
6 throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit");
7 }catch(konforka::exception& ke){
8 ke.see(CODEPOINT); throw;
9 }
10 }catch(konforka::exception& ke){
11 ke.see(CODEPOINT); throw;
12 }
13 }catch(konforka::exception& ke){
14 ke.see(CODEPOINT); throw;
15 }
16</%code>
diff --git a/htdocs/exceptions/index.chtml b/htdocs/exceptions/index.chtml
new file mode 100644
index 0000000..cc0ed8a
--- a/dev/null
+++ b/htdocs/exceptions/index.chtml
@@ -0,0 +1,52 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%codemethod string title() %>
4 return "exceptions handling";
5</%codemethod>
6<%method void content() %>
7 <h1>site-C-ing exception handling</h1>
8 <p>
9 The purpose of this section is to give an overview of the <em>site-C-ing</em>
10 exception handling mechanism. Before the web visitor can see the page each
11 site-C-ing component goes through a few stages, namely, preprocessing,
12 compiling and execution. Having three stages to go through also means the
13 stages one can fail to go through and three exciting opportunities to handle
14 different errors.
15 </p>
16 <p>
17 First each component is preprocessed so that you can feed the valid c++ code
18 to the compiler. Here is where the preprocessor can choke at your broken
19 source code. Once preprocessor failes to parse your code it will throw an
20 exception which <em>site-C-ing</em> will catch and pass to <a
21 href="/sources/htdocs/handlers/exception_dev" title="development mode
22 exception handler source">the exception handler component</a>. Want to <a
23 href="/exceptions/preprocess">read more</a> about preprocessor exception
24 handling?
25 </p>
26 <p>
27 After the preprocessing stage is over we have a great opportunity to catch
28 the compile-time errors. After <em>site-C-ing</em> fails to compile the
29 component it throws another exception and passes it to the same handler which
30 may show you some information on what's gone wrong with your source code from
31 the compiler's perspective. If you've gone this far you definitely want to <a
32 href="/exceptions/compile">read more</a> about the compiler error handling.
33 </p>
34 <p class="note">
35 Note, that it is likely that you will want to disable the steps above for the
36 production environment to save time on unnecessary checking whether the
37 component is up to date.
38 </p>
39 <p>
40 Finally, we need to execute the component and present its output to the web
41 site visitor. This is also where things may go wrong and here is where your
42 component may throw an exception for the engine to catch and pass to the
43 handler. Feel free to <a href="/exceptions/runtime">learn more</a> about it
44 as well.
45 </p>
46 <p class="note">
47 One more thing you will likely want to have differently in production
48 environment is <a href="/sources/htdocs/handlers/exception_prod"
49 title="production mode exception handler source">an exception handler</a>
50 which will not give out that much unnecessary information to the user.
51 </p>
52</%method>
diff --git a/htdocs/exceptions/preprocess.chtml b/htdocs/exceptions/preprocess.chtml
new file mode 100644
index 0000000..8516139
--- a/dev/null
+++ b/htdocs/exceptions/preprocess.chtml
@@ -0,0 +1,46 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%constructor>
4 b_strict = false;
5</%constructor>
6<%codemethod string title() %>
7 return "preprocessor exceptions handling";
8</%codemethod>
9<%method void content() %>
10 <h1>site-C-ing preprocessor exception handling</h1>
11 <p>
12 It was one of those days when you just can't type right and can't think of
13 what you're typing. It is not unusual that, under such circumstances, you end
14 up with a code like <a
15 href="/view/htdocs/exceptions/development/preprocess.chtml" target="insert"
16 title="the link opens in the frame below">this</a> -- by the time you were
17 about to close your <code>&lt;%code&gt;</code> block you were thinking about
18 some constructor in some component elsewhere in the universe.
19 </p>
20 <p>
21 <em>site-C-ing</em> parser will see the inconsistency and throw an exception
22 which will be caught and passed to <a
23 href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
24 opens in the frame below">the handler</a>, specified in <a
25 href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
26 link opens in the frame below">the configuration file</a>, which will produce
27 some nice, human-readable <a href="/exceptions/development/preprocess"
28 target="insert" title="the link opens in the frame below">output</a>. Well,
29 you may not wish to give out all this information in the production
30 environment, so you just put in your <a
31 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
32 link opens in the frame below">configuration file</a> some <a
33 href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
34 opens in the frame below">different handler</a>, which just gives user <a
35 href="/exceptions/production/preprocess" target="insert" title="the link
36 opens in the frame below">a friendly yet lame excuse</a>.
37 </p>
38
39 <div class="insert">
40 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
41 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
42 support it. That is okay, it still will open links somehow.</p>
43 </iframe>
44 </div>
45
46</%method>
diff --git a/htdocs/exceptions/production/.htaccess b/htdocs/exceptions/production/.htaccess
new file mode 100644
index 0000000..01cb5ec
--- a/dev/null
+++ b/htdocs/exceptions/production/.htaccess
@@ -0,0 +1,3 @@
1<Files compile.chtml>
2 deny from all
3</Files>
diff --git a/htdocs/exceptions/production/.scrc b/htdocs/exceptions/production/.scrc
new file mode 100644
index 0000000..d97eeb4
--- a/dev/null
+++ b/htdocs/exceptions/production/.scrc
@@ -0,0 +1,2 @@
1ExceptionHandler /handlers/exception_prod
2AutoBuildFiles -*
diff --git a/htdocs/exceptions/production/compile.chtml b/htdocs/exceptions/production/compile.chtml
new file mode 100644
index 0000000..3611ca9
--- a/dev/null
+++ b/htdocs/exceptions/production/compile.chtml
@@ -0,0 +1,12 @@
1<html>
2 <head>
3 <title>I'm gonna make a number of mistakes!</title>
4 </head>
5 <body>
6% ind a = 2;
7% #include "erroneous.h"
8% unsigned int a = -1;
9% int j = k;
10 </body>
11</html>
12% /* vim:set ft=sitecing: */
diff --git a/htdocs/exceptions/production/compile.html b/htdocs/exceptions/production/compile.html
new file mode 100644
index 0000000..faa0ab9
--- a/dev/null
+++ b/htdocs/exceptions/production/compile.html
@@ -0,0 +1,44 @@
1
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4 <head>
5 <title>Server-side exception</title>
6 <style type="text/css">
7 <!--
8 body {
9 font-family: sans-serif;
10 font-size: 12pt;
11 }
12 h1 {
13 font-family: serif;
14 font-size: 130%;
15 font-weight: bold;
16 text-align: center;
17 }
18 p {
19 text-indent: 2em;
20 text-align: justify;
21 }
22
23 div.powered {
24 margin: 2em 0px 0px 50%;
25 padding: 1ex 2ex;
26 text-align: right;
27 font-family: serif;
28 font-size: 140%;
29 font-weight: bold;
30 border-top: solid 2px black;
31 border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
32 background: #c0c0f0;
33 }
34 -->
35 </style>
36 </head>
37 <body>
38 <h1>server-side exception</h1>
39 <p>Something has gone really wrong with the server. Feel free to report the
40 incident to <a href="mailto:root@localhost" title="e-mail
41 server administrator">webmaster</a>.</p>
42 <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
43 </body>
44</html>
diff --git a/htdocs/exceptions/production/erroneous.h b/htdocs/exceptions/production/erroneous.h
new file mode 100644
index 0000000..060a57e
--- a/dev/null
+++ b/htdocs/exceptions/production/erroneous.h
@@ -0,0 +1 @@
a+2=5;
diff --git a/htdocs/exceptions/production/preprocess.chtml b/htdocs/exceptions/production/preprocess.chtml
new file mode 100644
index 0000000..f7405e7
--- a/dev/null
+++ b/htdocs/exceptions/production/preprocess.chtml
@@ -0,0 +1,14 @@
1<html>
2 <body>
3 <p>
4 I was writing this component in a hurry, having a lot of things to distract
5 me, so no wonder I made mistake.
6 <%code>
7 /* I do not even remember what I was going to put in this code block. And
8 * of course I didn't mean to forget that this is just a block of code, not
9 * a constructor...
10 */
11 </%constructor>
12 </p>
13 </body>
14</html>
diff --git a/htdocs/exceptions/production/runtime.chtml b/htdocs/exceptions/production/runtime.chtml
new file mode 100644
index 0000000..4a494bd
--- a/dev/null
+++ b/htdocs/exceptions/production/runtime.chtml
@@ -0,0 +1,16 @@
1%%decl #include <konforka/exception.h>
2<%code>
3 try{
4 try{
5 try{
6 throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit");
7 }catch(konforka::exception& ke){
8 ke.see(CODEPOINT); throw;
9 }
10 }catch(konforka::exception& ke){
11 ke.see(CODEPOINT); throw;
12 }
13 }catch(konforka::exception& ke){
14 ke.see(CODEPOINT); throw;
15 }
16</%code>
diff --git a/htdocs/exceptions/runtime.chtml b/htdocs/exceptions/runtime.chtml
new file mode 100644
index 0000000..d0a8e14
--- a/dev/null
+++ b/htdocs/exceptions/runtime.chtml
@@ -0,0 +1,47 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%constructor>
4 b_strict = false;
5</%constructor>
6<%codemethod string title() %>
7 return "runtime exceptions handling";
8</%codemethod>
9<%method void content() %>
10 <h1>site-C-ing runtime exception handling</h1>
11 <p>
12 The component may throw an exception while executing and the
13 <em>site-C-ing</em> will gladly pass it to the handler component which will
14 give the user appropriate output (unless it throws an exception itself, of
15 course). Here you will see an example output provided by the handler bundled
16 with the <em>site-C-ing</em>.
17 </p>
18
19 <p>
20 Suppose you have <a href="/view/htdocs/exceptions/development/runtime.chtml"
21 target="insert" title="the link opens in the frame below">a component</a>,
22 which at some point throws an exception. Of course, <em>site-C-ing</em> will
23 catch the exception and pass it to <a
24 href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
25 opens in the frame below">the handler</a>, specified in <a
26 href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
27 link opens in the frame below">the configuration file</a>, which will produce
28 some nice, human-readable <a href="/exceptions/development/runtime"
29 target="insert" title="the link opens in the frame below">output</a>. Well,
30 you may not wish to give out all this information in the production
31 environment, so you just put in your <a
32 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
33 link opens in the frame below">configuration file</a> some <a
34 href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
35 opens in the frame below">different handler</a>, which just gives user <a
36 href="/exceptions/production/runtime" target="insert" title="the link opens
37 in the frame below">a friendly yet lame excuse</a>.
38 </p>
39
40 <div class="insert">
41 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
42 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
43 support it. That is okay, it still will open links somehow.</p>
44 </iframe>
45 </div>
46
47</%method>