]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/error-html.php
set exception handler by request format, not always HTML
[nominatim.git] / lib / template / error-html.php
1 <?php
2
3     $title = 'Internal Server Error';
4     if ( $exception->getCode() == 400 ) {
5         $title = 'Bad Request';
6     }
7 ?>
8 <!DOCTYPE html>
9 <html lang="en">
10 <head>
11     <style>
12         em { font-weight: bold; font-family: monospace; color: #e00404; background-color: #ffeaea; }
13     </style>
14 </head>
15 <body>
16     <h1><?php echo $title ?></h1>
17     
18     <?php if (get_class($exception) == 'Nominatim\DatabaseError') { ?>
19
20         <p>Nominatim has encountered an internal error while accessing the database.
21            This may happen because the database is broken or because of a bug in
22            the software.</p>
23
24     <?php } else { ?>
25
26         <p>Nominatim has encountered an error with your request.</p>
27
28     <?php } ?>
29
30
31     <h3>Details</h3>
32
33     Uncaught exception <em><?php echo get_class($exception) ?></em>
34     with message <em><?php echo $exception->getMessage() ?></em>
35
36     <?php if (CONST_Debug) { ?>
37         <br>
38         thrown in <em><?php $exception->getFile() . '('. $exception->getLine() . ')' ?></em>.
39
40         <?php if (get_class($exception) == 'Nominatim\DatabaseError') { ?>
41
42             <h3>SQL Error</h3>
43             <em><?php echo $exception->getSqlError() ?></em>
44
45             <pre><?php echo $exception->getSqlDebugDump() ?></pre>
46
47         <?php } ?>
48
49         <h3>Stack trace</h3>
50         <pre><?php echo $exception->getTraceAsString() ?></pre>
51
52     <?php } ?>
53
54     <p>
55         If you feel this error is incorrect feel file an issue on
56         <a href="https://github.com/openstreetmap/Nominatim/issues">Github</a>.
57
58         Please include the error message above and the URL you used.
59     </p>
60 </body>
61 </html>