-
Notifications
You must be signed in to change notification settings - Fork 10
Error Handling
Doug Schmidt edited this page Sep 15, 2017
·
1 revision
The com.aquaticinformatics:aquarius.sdk package uses the standard ServiceStack error-handling approach, throwing a WebServiceException whenever a request does not complete successfully (with a 2xx HTTP status code).
Usually, the getErrorCode() and getErrorMessage() methods of the WebServiceException object are all that need to be inspected to diagnose what went wrong. Other properties (like the HTTP status code and response headers) are available on the WebServiceException class if more detailed analysis is required.
try (AquariusClient client = AquariusClient.createConnectedClient("myserver", "myuser", "mypassword")) {
var request = new LocationDescriptionListServiceRequest {LocationName = "My Location"};
var response = client.PublishClient.Get();
Console.WriteLine($"{response.LocationDescriptions.Count} matches found.");
} catch (WebServiceException e) {
System.out.format("AQTS ERROR: "ERROR: %d (%s) %s\n", e.getStatusCode(), e.getErrorCode(), e.getErrorMessage());
} catch (Exception e) {
System.out.format("ERROR: That was weird! %s", e.getMessage());
e.printStackTrace();
}Still have questions? Feel free to raise an issue or contact our Support Team
- SDK design philosophy (on the .NET SDK wiki)
- AQTS client concepts
- AQTS code examples
- Troubleshooting tips