I am looking to fine-tune our implementation of the datasource loading to include error information in case the retrieval failed on the server for some reason.
I am at a point where the
returns null in case an error occurred on the server. Currently we throw a general 'Failed to load datasource' error from there to signal the problem.
This is how we have it at this time:
At best, I would like to include the actual cause of the error (including a text message, error code, trace ...) in the exception which is created there.
We have an override of the 'DataSourceLoader' servlet in place, where we are able to trap the error and do something with it. I have been looking for some way to send the error information back to the client, but failed to come up with something that does the trick.
The default implementation of the 'DataSourceLoader' returns the error (when we throw it in our servlet) in HTML format when the debug property is set to true or performs a redirect to the general error page otherwise. The first approach results in a script error on the client. The second approach also gave me a script error on the client but this might have been caused by the lack of a configured error page. I managed to bypass this by also overriding the 'handleError' methods in our custom 'DataSourceLoader' servlet.
Could you please provide some insight into how this should be implemented or point out what we are missing?
(We use SmartGWT EE build SC_SNAPSHOT-2011-01-25)
I am at a point where the
Code:
DataSource.getDataSource(dsID)
This is how we have it at this time:
Code:
DataSource ds = DataSource.getDataSource(dsID); if (ds == null) { throw new MyClientException("Unable to create data source '" + dsID + "', check application server connection."); }
We have an override of the 'DataSourceLoader' servlet in place, where we are able to trap the error and do something with it. I have been looking for some way to send the error information back to the client, but failed to come up with something that does the trick.
The default implementation of the 'DataSourceLoader' returns the error (when we throw it in our servlet) in HTML format when the debug property is set to true or performs a redirect to the general error page otherwise. The first approach results in a script error on the client. The second approach also gave me a script error on the client but this might have been caused by the lack of a configured error page. I managed to bypass this by also overriding the 'handleError' methods in our custom 'DataSourceLoader' servlet.
Could you please provide some insight into how this should be implemented or point out what we are missing?
(We use SmartGWT EE build SC_SNAPSHOT-2011-01-25)
Comment