[%###
This page demonstrates Dancer's stack-trace error handling in development mode.
###%]

<!-- BootStrap NavBar -->
<div class="navbar">
  <div class="navbar-inner">
    <div class="container">
	<h3><a class="brand" href="[% request.uri_base %]"><img src="images/dancer_man.png"> Perl Dancer</a></h3>
    </div>
  </div>
</div>

<!-- HEADER line -->
<div class="container">

<div class="page-header">
	<div class="row">
		<div class="span12">
			<h2>Dancer + Bootstrap Examples</h2>
			<h1>Dancer's Error Handling</h1>
		</div>
	</div>
</div>

<div class="row">
	<div class="span12">
	
	This page demonstrates Dancer's error handling code, in development and production modes.
	<br/>
	In development mode, any <code>die</code> statement will generate a detailed stack-trace with loads of information. In production mode, <code>die</code> statements will generate a generic error message.
	<br/>
	<br/>

	<h3>Code Highlights</h3>
	<ul>
		<li>The Dancer code is in
                    <a href="[% request.uri_for("/show_file",file => "error_handling.pm", example => "Error Handling", url => request.uri_for("/error_handling") ) %]">
                    <code>./lib/examples/error_handling.pm</code> <i class="icon-eye-open"></i> </a>.
                </li>

		<li>This HTML tempate is in
                    <a href="[% request.uri_for("/show_file",file => "error_handling.tt", example => "Error Handling", url => request.uri_for("/error_handling") ) %]">
                    <code>./views/examples/error_handling.tt</code> <i class="icon-eye-open"></i> </a>.
                </li>
		<li>Showing or hiding the detailed error information is controlled by the <a target="_blank" href="http://search.cpan.org/dist/Dancer/lib/Dancer/Introduction.pod#EXECUTION_ERRORS">show_errors</a> configuration key - which can be set either in the YML configuration files or at runtime.</li>
		<li>Standard Dancer applications have <a target="_blank" href="http://search.cpan.org/dist/Dancer/lib/Dancer/Introduction.pod#CONFIGURATION_AND_ENVIRONMENTS">two YML configuration files</a>: <strong>development</strong> settings go in <code>./environments/development.yml</code> and <strong>production</strong> settings go in <code>./environment/production.yml</code>.</li>
	</ul>

	</div>
</div>

<br/>
<br/>

<div class="row">
	<div class="span12">
[%################################
  Error Handling Example starts here
#################################%]

<form class="form-horizontal" method="post">
<fieldset>
	<legend>Error Handling Example</legend>

<div class="alert alert-info">
By clicking on the button below, you will get a <strong>Runtime error message</strong> - it's not a bug - it's the whole point of this demonstration.
</div>

	<!-- Radio Buttons Controls -->
	<div class="control-group"> 
		<label class="control-label">Show errors</label> 
		<div class="controls"> 
			<label class="radio"> 
				<input type="radio" name="showerrors" id="showerror1" value="1" checked> 
				yes (development mode)
			</label> 
			<label class="radio"> 
				<input type="radio" name="showerrors" id="showerror2" value="0"> 
				no (production mode)
			</label> 
		</div> 
	</div> 


	<!-- The Submit buttons -->
	<div class="form-actions"> 
		<button type="submit" class="btn btn-primary">Crash and Burn!</button> 
	</div> 
</fieldset>
</form>

	</div>
</div>