a tiny mvc framework for php using php-activerecord
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

rescuer: handle \ActiveRecord\RecordNotFound as a 404

+6 -4
+6 -4
lib/rescuer.php
··· 28 28 '\HalfMoon\InvalidAuthenticityToken', 29 29 '\HalfMoon\UndefinedFunction', 30 30 '\HalfMoon\BadRequest', 31 + '\ActiveRecord\RecordNotFound', 31 32 ); 32 33 33 34 static function error_handler($errno, $errstr, $errfile, $errline) { ··· 145 146 $out .= $call["line"]; 146 147 147 148 $out .= " in "; 148 - 149 + 149 150 if ($html) 150 151 $out .= "<strong>" . h($call["function"]) . "(</strong>"; 151 152 else ··· 249 250 /* production mode, try to handle gracefully */ 250 251 251 252 if ($exception instanceof \HalfMoon\RoutingException || 252 - $exception instanceof \HalfMoon\UndefinedFunction) { 253 + $exception instanceof \HalfMoon\UndefinedFunction || 254 + $exception instanceof \ActiveRecord\RecordNotFound) { 253 255 Request::send_status_header(404); 254 256 255 257 if (file_exists($f = HALFMOON_ROOT . "/public/404.html")) { ··· 280 282 require_once($f); 281 283 } 282 284 } 283 - 285 + 284 286 elseif ($exception instanceof \HalfMoon\InvalidAuthenticityToken) { 285 287 /* be like rails and give the odd 422 status */ 286 288 Request::send_status_header(422); ··· 305 307 <?php 306 308 } 307 309 } 308 - 310 + 309 311 else { 310 312 Request::send_status_header(500); 311 313