]> git.andy128k.dev Git - ipf.git/commitdiff
IPF_HTTP_Error404 exception is added
authorAndrey Kutejko <andy128k@gmail.com>
Thu, 20 Oct 2011 14:18:16 +0000 (16:18 +0200)
committerAndrey Kutejko <andy128k@gmail.com>
Thu, 20 Oct 2011 14:18:16 +0000 (16:18 +0200)
ipf/http/error404.php [new file with mode: 0644]
ipf/router.php

diff --git a/ipf/http/error404.php b/ipf/http/error404.php
new file mode 100644 (file)
index 0000000..a6b1a9b
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+
+class IPF_HTTP_Error404 extends IPF_Exception
+{
+}
+
index 5bb0c5a1bd1de5975968eb604d5d5d2d098b4561..3355ae67500c94581c29c48a93bc7063407815d0 100644 (file)
@@ -8,7 +8,7 @@ class IPF_Router
         else
             return new IPF_HTTP_Response_ServerError($e);
     }
-    
+
     public static function dispatch($query='')
     {
         try{
@@ -66,6 +66,8 @@ class IPF_Router
                             return IPF_Router::response500(new IPF_Exception('function '.$suburl['func'].'() must return IPF_HTTP_Response instance'));
                         }
                         return $r;
+                    } catch (IPF_HTTP_Error404 $e) {
+                        return new IPF_HTTP_Response_NotFound();
                     } catch (IPF_Exception $e) {
                         return IPF_Router::response500($e);
                     }