I am trying to handle the RPCRequest failure programatically by doing the following:
DSRequest request = new DSRequest();
request.setWillHandleError(true);
removeSelectedData(new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
int statusCode = response.getStatus();
if (statusCode == RPCResponse.STATUS_SUCCESS) {
SC.say("Delete was successful");
} else {
String responseMessage = response.getDataAsString();
SC.warn(responseMessage);
}
}
}, request);
and for a failed request with the following response data from the developer console:
[
{
data:"Remove Operation failed due to relational integrity constraints.",
invalidateCache:false,
isDSResponse:true,
operationType:"remove",
queueStatus:-1,
status:-1
}
]
I get the following exception on the line response.getDataAsString()
java.lang.String cannot be cast to com.google.gwt.core.client.JavaScriptObject.
How should I get the error message if not as above?
If I do not handle the request my self, that is, comment out the line // request.setWillHandleError(true); then the warn dialogue is shown with the proper message. How do I do the same thing myself. Reason I want to do it myself is there will be other client code to be executed in failure that is not shown in the simplified example above.
Thanks.
I am using: Isomorphic SmartClient/SmartGWT Framework (SNAPSHOT_v8.3d_2012-08-23/EVAL Deployment 2012-08-23)
DSRequest request = new DSRequest();
request.setWillHandleError(true);
removeSelectedData(new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
int statusCode = response.getStatus();
if (statusCode == RPCResponse.STATUS_SUCCESS) {
SC.say("Delete was successful");
} else {
String responseMessage = response.getDataAsString();
SC.warn(responseMessage);
}
}
}, request);
and for a failed request with the following response data from the developer console:
[
{
data:"Remove Operation failed due to relational integrity constraints.",
invalidateCache:false,
isDSResponse:true,
operationType:"remove",
queueStatus:-1,
status:-1
}
]
I get the following exception on the line response.getDataAsString()
java.lang.String cannot be cast to com.google.gwt.core.client.JavaScriptObject.
How should I get the error message if not as above?
If I do not handle the request my self, that is, comment out the line // request.setWillHandleError(true); then the warn dialogue is shown with the proper message. How do I do the same thing myself. Reason I want to do it myself is there will be other client code to be executed in failure that is not shown in the simplified example above.
Thanks.
I am using: Isomorphic SmartClient/SmartGWT Framework (SNAPSHOT_v8.3d_2012-08-23/EVAL Deployment 2012-08-23)
Comment