Comments (5)
Feedback by Nesbert in the google groups:
+1 for Error handler... in the interim here is an example of how am dealing with issue https://gist.github.com/3701633#L113
from cphalcon.
Another +1 for this. With options to configure per module too, set error handler to module, controller, action and pass in exception object or something?
from cphalcon.
+1 for error handler.
This is not normal 404 response for production website: http://phalconphp.com/indexxxx
And i can't figure out where and how i can add internal forward like:
$app->dispatcher->forward(array("controller" => "index", "action" => "error404"));
from cphalcon.
Right now the main script of the website as it can be seen in github
encapsulates operations with a try catch.
When an exception happens it only prints out the error message from the
exception.
Working a bit on the try catch code could trap and display things better
until this feature is developed. :)
On Oct 16, 2012 8:07 PM, "JohnnyAjax" [email protected] wrote:
+1 for error handler.
This is not normal 404 response for production website:
http://phalconphp.com/indexxxxโ
Reply to this email directly or view it on GitHubhttps://github.com//issues/66#issuecomment-9511773.
from cphalcon.
0.6.0 now supports an error handler for exceptions produced by the dispatcher
$di->set('dispatcher', function(){
//Create/Get an EventManager
$eventsManager = new Phalcon\Events\Manager();
//Attach a listener
$eventsManager->attach("dispatch", function($event, $dispatcher, $exception) {
//The controller exists but the action not
if ($event->getType() == 'beforeNotFoundAction') {
$dispatcher->forward(array(
'controller' => 'index',
'action' => 'show404'
));
return false;
}
//Alternative way, controller or action doesn't exists
if ($event->getType() == 'beforeException') {
switch ($exception->getCode()){
case Phalcon\Dispatcher::EXCEPTION_HANDLER_NOT_FOUND:
case Phalcon\Dispatcher::EXCEPTION_ACTION_NOT_FOUND:
$dispatcher->forward(array(
'controller' => 'index',
'action' => 'show404'
));
return false;
}
}
});
$dispatcher = new Phalcon\Mvc\Dispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
from cphalcon.
Related Issues (20)
- [BUG]: "SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens" produced when you use the same named binded parameter more than once in query conditions HOT 4
- [DOC] - Remove dead links in CONTRIBUTING.md HOT 1
- [NFR]: Implement autocompletion support for modern IDE HOT 2
- [BUG]: Discrepancy Between Total Items in Paginator and Direct Query Using Phalcon's QueryBuilder HOT 8
- [BUG]: Phalcon\Filter\Sanitize\BoolVal is not working as expected. HOT 1
- [BUG]: Classes that implement Serializable have wrong function declaration HOT 1
- [BUG]: Phalcon\Support classes leak memory round 2 HOT 10
- [NFR]: can you make wordpress optimized for phalcon or as รง.compiled alongwoth conpiled superspeed caching
- Phalcon 5.7.0 Release Reports 5.6.2 as Internal Version Number HOT 7
- [BUG]: Query builder wrong assumption GROUP BY should contain model columns (Postgres)
- [BUG]: Fatal error on route group getHostname HOT 1
- [BUG]: `Phalcon\Mvc\Model\Query` does not handle internal transaction on PDOException HOT 3
- [NFR]: Events for Storage and Cache classes HOT 1
- [BUG] Wrong interface on compileSource leads to fatal error HOT 1
- [BUG]: Problem with saving null value on related entities.
- [BUG]: StatementList and readMetaDataIndex wrong return types HOT 3
- [BUG]: View: return value of getActiveRenderPath() | low priority
- [BUG]: if model has field `source` ,it cannot be assigned by `assign` HOT 2
- [BUG]: Deprecated: Use of "static" in callables is deprecated
- [BUG]: Phalcon\Html\Helper\Input\Select not working correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cphalcon.