Introduction
The Cabron Connector uses the Printr Debugger as debugging tool. You can read about Printr on this site on sourceforge.net.
The debugger is installed together with Cabron, and is accessible from Window > Printr Debugger from the flash authoring environment.
To enable debugging in Cabron, you should include the necessary files in the first frame:
#include "Cabron.as"
#include "CabronDebugger.as"
If you open now the Debugger panel, and start the movie that contains remoting with Cabron Connector, each important remothing-related action will be presented in the Debugger panel.
This probably will help you a lot in the development phase, but when going live, be sure to remove the last inclusion.
Error Messages from PHP
If an error occurs, or a warning message is printed out during the execution of the PHP service, the content is sent to the Flash, and will be forwarded to the error handler (onStatus or methodName_Status) of the responder.
This message is also displayed in the Printr Debugger Panel. You probably know, that PHP by default inputs error messages in HTML format. When this message is dislayed in the Debugger, it's pretty hard to read it. To solve this problem, you should switch to html mode using the text view/html view button from the menu of the debugger. Also, the word wrap button could help in some cases.
Log file
If an error occurs in the gateway after the remote data is serialized, this can not be transmitted to the Flash, and can not be handled by the error handler method of the responder. These errors are written to a log file, it's default location is gateway/log.html. You can change the location of this file by editing the gateway.php
$gateway->logFile = "./log.html";
User-generated errors
It's possible to create errors from the PHP services that will propagate to the Flash movie.
The syntax:
cabronError($detailedDesc [,$errCode [,$shortDesc]]);
If the error code is not specified, it will be set to 100. In case of user-generated errors, the code should be greater than 100, otherwise the code will be incremented by 100.
If the short description is not specified, it will be set to the detailed description
The short description should contain an error message that can be shown in the interface, the detailed description should contain a message that helps the debugging process.
|
Configuring the debugger
There are a lot of actions that are performed during a remoting call, and probably you don't want to see all of them in the Debugger panel. You can configure which actions should be displayed, and which not.
This can be made using the setCabronDebugOption() ActionScript function. The function takes two parameters: the option name as string, and the option value, as boolean. The possible options are:
option |
default |
description |
showCallArguments |
false |
displays the calling arguments of methods |
outputErrors |
true |
if an error occures, it is forwarded to the onStatus handler of the responder. Beside this, it is shown in the Debugger too. If this value is true, the error messages will be shown in the output window, even if the Debugger is closed. |
outputWarnings |
true |
warnings can appear if there are extra outputs caught by the gateway. This can mean that the user printed something in the service, or the service source printed a warning message. In this case the result are valid, but there should be an error somewhere in the code. In this case no error handler is called, the Result is considered valid, but the warning text is sent to the Debugger. If this flag is set to true, it's sent to the output too. |
showResultData |
false |
displays the structure that was returned by the service |
showMethodProfile |
false |
if the method profile is available, it will be shown in the Debugger Panel. This should be enabled from the service too. |
showTimedDeser |
true |
if it's true, and the deserialization mode is set to timed ('T'), each time the deserialization is performed (and the Working handler is called), a Working message is displayed in the debugger. |
showPacketSize |
false |
reports the packet size received from the service |
Example:
#include "printr_mx.as"
#include "Cabron.as"
#include "CabronDebugger.as"
setCabronDebugOption("showCallArguments",true);
setCabronDebugOption("outputErrors",false);
setCabronDebugOption("outputWarnings",false);
setCabronDebugOption("showResultData",true);
setCabronDebugOption("showMethodProfile",true);
setCabronDebugOption("showTimedDeser",true);
setCabronDebugOption("showPacketSize",true);
var cc = new CabronConnector();
|