From 71f4cc84c3788c6904ede17cd626a9ca9c349e3b Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sun, 30 Jan 2005 00:57:53 +0000 Subject: initial commit into repository --- (limited to 'htdocs/exceptions') 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 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%constructor> + b_strict = false; + +<%codemethod string title() %> + return "compile-time exceptions handling"; + +<%method void content() %> +

site-C-ing compile-time exception handling

+

+ Similar to preprocessing exceptions + 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. +

+

+ Once you complete writing your erroneous code and + site-C-ing 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 the exception handler, + specified in the configuration + file, takes over the process and gives you the report. Like with any handler, you may wish to + set some different handler in your production configuration, which just gives + user a friendly yet lame excuse. +

+

+ 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. +

+ +
+ +
+ + 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 @@ + + deny from all + 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 @@ +ExceptionHandler /handlers/exception_dev +AutoBuildFiles -* 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 @@ + + + I'm gonna make a number of mistakes! + + +% ind a = 2; +% #include "erroneous.h" +% unsigned int a = -1; +% int j = k; + + +% /* 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 @@ + + + + + failed to compile component + + + + +
+

error compiling component 'exceptions/development/compile.chtml'

+ +
+

exceptions/development/compile.chtml

+
    +
  •     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>
  • +
+
+ exceptions/development/compile.chtml: In member function `virtual void _SCC_exceptions_development_compile_chtml::main(int, char*)':
+exceptions/development/compile.chtml:6: error: `ind' undeclared (first use this function)
+exceptions/development/compile.chtml:6: error: (Each undeclared identifier is reported only once for each function it appears in.)
+exceptions/development/compile.chtml:6: error: expected `;' before "a" +
+
+ +
+

exceptions/development/compile.chtml

+
    +
  •     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: */
  • +
+
+ In file included from exceptions/development/compile.chtml:7: +
+
+ +
+

exceptions/development/erroneous.h

+
    +
  •     1  a+2=5;
  • + +
  •     2 
  • +
+
+ ./erroneous.h:1: error: `a' undeclared (first use this function) +
+
+ +
+

exceptions/development/compile.chtml

+
    +
  •     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: */
  • + +
  •    13 
  • +
+
+ exceptions/development/compile.chtml:8: warning: converting of negative value `-0x000000001' to `unsigned int' +
+
+ +
+

exceptions/development/compile.chtml

+
    +
  •     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: */
  • + +
  •    13 
  • +
+
+ exceptions/development/compile.chtml:9: error: `k' undeclared (first use this function)
+ +
+
+ +
+ +
Powered by site-C-ing.
+ + + + + + + + + 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 @@ + + +

+ I was writing this component in a hurry, having a lot of things to distract + me, so no wonder I made mistake. + <%code> + /* I do not even remember what I was going to put in this code block. And + * of course I didn't mean to forget that this is just a block of code, not + * a constructor... + */ + +

+ + 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 @@ +%%decl #include +<%code> + try{ + try{ + try{ + throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit"); + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + 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 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%codemethod string title() %> + return "exceptions handling"; + +<%method void content() %> +

site-C-ing exception handling

+

+ The purpose of this section is to give an overview of the site-C-ing + 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. +

+

+ 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 site-C-ing will catch and pass to the exception handler component. Want to read more about preprocessor exception + handling? +

+

+ After the preprocessing stage is over we have a great opportunity to catch + the compile-time errors. After site-C-ing 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 read more about the compiler error handling. +

+

+ 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. +

+

+ 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 learn more about it + as well. +

+

+ One more thing you will likely want to have differently in production + environment is an exception handler + which will not give out that much unnecessary information to the user. +

+ 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 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%constructor> + b_strict = false; + +<%codemethod string title() %> + return "preprocessor exceptions handling"; + +<%method void content() %> +

site-C-ing preprocessor exception handling

+

+ 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 this -- by the time you were + about to close your <%code> block you were thinking about + some constructor in some component elsewhere in the universe. +

+

+ site-C-ing parser will see the inconsistency and throw an exception + which will be caught and passed to the handler, specified in the configuration file, which will produce + some nice, human-readable output. Well, + you may not wish to give out all this information in the production + environment, so you just put in your configuration file some different handler, which just gives user a friendly yet lame excuse. +

+ +
+ +
+ + 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 @@ + + deny from all + 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 @@ +ExceptionHandler /handlers/exception_prod +AutoBuildFiles -* 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 @@ + + + I'm gonna make a number of mistakes! + + +% ind a = 2; +% #include "erroneous.h" +% unsigned int a = -1; +% int j = k; + + +% /* 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 @@ + + + + + Server-side exception + + + +

server-side exception

+

Something has gone really wrong with the server. Feel free to report the + incident to webmaster.

+
Powered by site-C-ing.
+ + 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 @@ + + +

+ I was writing this component in a hurry, having a lot of things to distract + me, so no wonder I made mistake. + <%code> + /* I do not even remember what I was going to put in this code block. And + * of course I didn't mean to forget that this is just a block of code, not + * a constructor... + */ + +

+ + 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 @@ +%%decl #include +<%code> + try{ + try{ + try{ + throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit"); + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + 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 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%constructor> + b_strict = false; + +<%codemethod string title() %> + return "runtime exceptions handling"; + +<%method void content() %> +

site-C-ing runtime exception handling

+

+ The component may throw an exception while executing and the + site-C-ing 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 site-C-ing. +

+ +

+ Suppose you have a component, + which at some point throws an exception. Of course, site-C-ing will + catch the exception and pass it to the handler, specified in the configuration file, which will produce + some nice, human-readable output. Well, + you may not wish to give out all this information in the production + environment, so you just put in your configuration file some different handler, which just gives user a friendly yet lame excuse. +

+ +
+ +
+ + -- cgit v0.9.0.2