Hi,
I'm using Smart GWT 2.1 with a JSON RestDataSource. I'm hoping the issue here is simply my lack of understanding.
I'm basically trying to catch any negative status codes raised by the transformResponse method and it doesn't seem to be working.
I have extended RestDataSource to include JSON bindings and the transformResponse method. In the transformResponse method I basically have a test where I'm simply setting
.
I instantiate the datasource in another class with the following:
I know for sure the datasource is working and setting the response status in transformResponse to -1 as I'm tracing it in Eclipse. Yet for some reason the handler never fires (I have a breakpoint on it).
Do I have to create a custom ErrorEvent and fire it myself in transformResponse in order for this to work? And if so, how do I do that?
Any help is greatly appreciated.
As an aside, in the javadoc for DataSource.addHandleErrorHandler, I am completely confused by what it means by "if you define this method" and "return false from this method".
"If you define this method on a DataSource, it will be called whenever the server returns a DSResponse with a status other than RPCResponse.STATUS_SUCCESS. You can use this hook to do DataSource-specific error handling. Unless you return false from this method, com.smartgwt.client.rpc.RPCManager#handleError will be called by Smart GWT right after this method completes."
I'm using Smart GWT 2.1 with a JSON RestDataSource. I'm hoping the issue here is simply my lack of understanding.
I'm basically trying to catch any negative status codes raised by the transformResponse method and it doesn't seem to be working.
I have extended RestDataSource to include JSON bindings and the transformResponse method. In the transformResponse method I basically have a test where I'm simply setting
Code:
response.setStatus(-1)
I instantiate the datasource in another class with the following:
Code:
DataSource loginDataSource = new JsonPostMessageRestDataSource(); ... loginDataSource.addHandleErrorHandler(new HandleErrorHandler() { @Override public void onHandleError(ErrorEvent event) { DSResponse response = event.getResponse(); } });
Do I have to create a custom ErrorEvent and fire it myself in transformResponse in order for this to work? And if so, how do I do that?
Any help is greatly appreciated.
As an aside, in the javadoc for DataSource.addHandleErrorHandler, I am completely confused by what it means by "if you define this method" and "return false from this method".
"If you define this method on a DataSource, it will be called whenever the server returns a DSResponse with a status other than RPCResponse.STATUS_SUCCESS. You can use this hook to do DataSource-specific error handling. Unless you return false from this method, com.smartgwt.client.rpc.RPCManager#handleError will be called by Smart GWT right after this method completes."
Comment