Package | com.vmware.data.query |
Class | public class DataException |
Inheritance | DataException ![]() |
Note: this class was generated from its Java counterpart DataException
Fault thrown by data-service adapters and providers to represent failure to fetch data. It is used in the error field of aResultSet
as shown in the examples below.
Example of a PropertyProviderAdapter's getProperties method returning a DataException
in the result.error field so that the error can be handled in the UI layer.
public ResultSet getProperties(PropertyRequestSpec propertyRequest) { // code to retrieve some properties of some objects ... ResultSet result = new ResultSet(); try { ... } catch (Exception e) { result.error = DataException.newInstance(e, propertyRequest.objects, propertyRequest.properties[0].propertyNames); } return result; }
[ResponseHandler(name= "{com.vmware.data.query.events.PropertyRequest.RESPONSE_ID}")] public function onDataRetrieved(request:PropertyRequest, result:Object, error:Error):void { if (error != null) { // Only display the error message here. You could also extract the objects and // properties information if error is a DataException. Alert.show(error.message); return; } ... }
... // Case of an error with the back-end data server ResultSet rs = new ResultSet(); rs.items = null; rs.totalMatchedObjectCount = 0; Exception ex = new Exception( "Chassis back-end server not responding! Check your configuration."); rs.error = DataException.newInstance(ex); return rs; ...
See also
Property | Defined By | ||
---|---|---|---|
objects : Array
Objects for which data could not be fetched. | DataException | ||
properties : Array
Properties that were not fetched. | DataException | ||
rootCause : Error
Error describing why the data could not be retrieved. | DataException |
objects | property |
public var objects:Array
Objects for which data could not be fetched. This can be omitted to signal the failure to return any object in the case of a DataProviderAdapter.
properties | property |
public var properties:Array
Properties that were not fetched.
rootCause | property |
public var rootCause:Error
Error describing why the data could not be retrieved. The DataException's message will be set to that rootCause's message.
Note: when the DataException is serialized back in the UI as an ActionScript object the rootCause will be null if there is no equivalent Flex error object but the DataException message is preserved to describe the rootCause.