forked from agordon/dancer_bootstrap_fontawesome_template
/
error_handling.tt
94 lines (78 loc) · 3.26 KB
/
error_handling.tt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
[%###
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 Exapmles<//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>