Closed alexrunrun closed 11 years ago
Depends on which error you want to handle. Form actions have a failure option which fires when the script errors.
Other direct functions have a similar way to handle errors, checkout the docs for an example.
I think he asks about exceptions( and php errors) and not bussines errors. For examp,e here http://www.sencha.com/products/extjs/extdirect it states that there ia mechanism to do that
*If an exception occurs on the server-side the router should also return the following error information when the router is in debugging mode.
type – ‘exception’ message – Message which helps the developer identify what error occurred on the server-side where – Message which tells the developer where the error occurred on the server-side. This exception handling within the router should have the ability to be turned on or off. This exception information should never be sent back to the client in a production environment because of security concerns.
Exceptions are meant for server-side exceptions. Not application level errors.*
Thanks for the clarification, that way of error handling is not implemented yet. I will fix this later!
fixed
Hi, I think there is one more thing that needs fixing: the method dispatchRPC should return $error when catching an exception, not $response['result'] = $error; So line number 248 in src/KJSencha/Controller/DirectController.php should be $response = $error; rather than $response['result'] = $error;
@alexrunrun #29 works for me in the KJSenchaExample, let me know if this fixes your problem and i'll merge it
How can I handle exceptions thrown by php? Let's say I would like to inform the user nicely there was an error.