public
Description: Midgard Components Framework 3rd generation
Homepage: http://www.midgard-project.org
Clone URL: git://github.com/bergie/midcom.git
Throw worst exception or default to 404
bergie (author)
Tue Jul 08 00:33:22 -0700 2008
commit  c97b4ff28914cef76f36fd4adf26d2a8c665bc6f
tree    101498ff901ad704f4992b43225fc8b8c9466d70
parent  b098464e994bc193bdeb4d81d4ad8e9e70818b55
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
...
115
116
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
119
120
0
@@ -115,22 +115,6 @@ class midcom_exception_notfound extends Exception
0
     }
0
 }
0
 
0
-class midcom_exception_allroutesfailed extends Exception
0
-{
0
- // FIXME: Some more elegant way to output the worst failure
0
- // Redefine the exception so message isn't optional
0
- public function __construct($message, $code = 500)
0
- {
0
- $string = ("Exception message stack");
0
- foreach($message as $m)
0
- {
0
- $string .= "{$m->message}\n";
0
- }
0
- $message = $string;
0
- parent::__construct($message, $code);
0
- }
0
-}
0
-
0
 /**
0
  * MidCOM 3 "unauthorized" exception
0
  *
...
246
247
248
249
 
 
 
 
 
 
 
 
 
 
 
 
 
250
251
252
...
246
247
248
 
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
0
@@ -246,7 +246,19 @@ class midcom_core_services_dispatcher_midgard implements midcom_core_services_di
0
             /**
0
               * @Todo: Dump better output if all routematches fail to handle
0
               */
0
- throw new midcom_exception_allroutesfailed(&$this->exceptions_stack);
0
+ foreach ($this->exceptions_stack as $exception)
0
+ {
0
+ switch (get_class($exception))
0
+ {
0
+ case 'midcom_exception_unauthorized':
0
+ throw $exception;
0
+ // This will exit
0
+ case 'midcom_exception_httperror':
0
+ throw $exception;
0
+ // This will exit
0
+ }
0
+ }
0
+ throw new midcom_exception_notfound("No route matches");
0
         }
0
     }
0
     

Comments

    No one has commented yet.