Example #1
0
 /**
  * Return a function for handling exceptions thrown by Propeller. A generic one has been provided.
  * 
  * @access public
  * @param  int    The status code for the request
  * @return Propeller\Response object
  */
 public function error($statusCode)
 {
     if (!empty($this->errorFunctions)) {
         if (isset($this->errorFunctions[$statusCode])) {
             return $this->errorFunctions[$statusCode];
         } else {
             if (isset($this->errorFunctions['*'])) {
                 // Specific error function not found? What about a global one?
                 return $this->errorFunctions['*'];
             }
         }
     }
     // Return the built in function
     return function ($message) use($statusCode) {
         return Response::onFormat(array('html' => View::make('errors/exception')->setData(array('title' => $statusCode . ' Error', 'content' => $message)), '*' => $message));
     };
 }